[Cubicweb] hook event for modification_date

Julien Jehannet julien.jehannet at logilab.fr
Wed Nov 3 10:47:46 CET 2010


> * Sylvain Thénault <sylvain.thenault at logilab.fr> [03-nov-2010 09:01]:
> 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*
yep, typo.

> > - 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.
I pointed out that all rql requests are in the _same_ transaction.
There is not really a _sequence logic_ (as written in my first email) in
terms of checkpoint steps.
If an error occured, all the transaction is rollbacked (from
before_update_entity to after_update_entity).
Quite obvious but I wanted to be precise 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.
That's what I want to say at first but thanks for the clarification (my
paragraph is not so clear..)
-- 
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/20101103/f9e8602a/attachment-0212.sig>


More information about the Cubicweb mailing list