papyrus
papyrus copied to clipboard
Add after create callback
Existing before_create is passed obj=None, so docstring is a bit messy ("..., and the database object to be updated").
The object is not always None, an object is passed if we send an ID!
Updated :-)
The object is not always None, an object is passed if we send an ID!
Ok so this is not a create nor insert, it is an update
We could discuss about what to do in such case, but it not the subject of this PR.
Should we call before_update in such case ?
before_update already exists for object update :-)
before_insert with the code you propose (I modified it a little bit by removing the unneeded create variable), it looks correct :-)