[Cubicweb] hook event for modification_date
Julien Jehannet
julien.jehannet at logilab.fr
Tue Nov 2 16:20:41 CET 2010
Hello the list,
I was wondering why we use the `before_update_entity` event in the
'metaattrsupdate' hook to manage the modification date of each entity
(see cubicweb.hooks.metadata file).
Even if our different use cases work already like a charm, I would consider
update this date info only at the end of the hooks sequence (using the *after* event).
Not you ?
Moreover, I saw that some cubes try to trigger this behaviour with this following snippet:
@objectify_selector
def entity_really_edited(cls, req, rset=None, **kwargs):
# when the status of an entity changes, the modification_date of the entity changes too
entity = rset.get_entity(0, 0)
if len(entity.cw_edited) == 1 and 'modification_date' in entity.cw_edited:
return 0
return 1
Have we some reasons to use `before_update_entity` event instead of 'after_update_entity' ?
Perhaps we could consider to switch to avoid the need of the previous snippet code selector ?
P.S. I will update the CubicWeb documentation with the responses found in this thread.
--
Julien JEHANNET LOGILAB, Paris (France)
http://www.cubicweb.org CubicWeb, le cadriciel du web sémantique
http://www.logilab.org Dépôt des logiciels libres conçus par Logilab
http://www.logilab.fr Informatique scientifique & Gestion de connaissances
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20101102/6bd1a360/attachment-0271.sig>
More information about the Cubicweb
mailing list