[Cubicweb] hook event for modification_date

Julien Jehannet julien.jehannet at logilab.fr
Tue Nov 2 16:58:13 CET 2010


> * Julien Jehannet <julien.jehannet at logilab.fr> [02-nov-2010 16:20]:
> 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).
> (...) 
> 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 ?

I transcript here some inputs from alf:

- `before_update_entity` is used in optimization purpose:
  since the rql request is always generated for this event, we inject the
  modification update here unlike `before_update_entity` which would imply
  a *new* rql request.

- just for the record: we should not enforced sequence logic since we
  used a transaction for both events

- remember that default CubicWeb behaviour is to not touch entity info
  from related parts (for example: if you've postal address, the related
  company will not be edited by default).
  It means that cube's hooks have responsability to update date
  modification of the composite entities if need.

-- 
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/be8e5666/attachment-0250.sig>


More information about the Cubicweb mailing list