[Cubicweb] hook event for modification_date

Sylvain Thénault sylvain.thenault at logilab.fr
Wed Nov 3 08:59:16 CET 2010


On 02 novembre 16:58, Julien Jehannet wrote:
> > * 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.

unlike *after_update_entity*

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

I don't understand what you mean here.
 
> - 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.

eg by default modification date is only updated when some entity's
*attributes* are modified, not when any relation is added/removed,
nor when some, composite or not, related entity is modified.

-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org




More information about the Cubicweb mailing list