[Cubicweb] Correct use of the 'person' cube
nicolas.chauvat at logilab.fr
Fri Jul 13 18:53:00 CEST 2012
On Fri, Jul 13, 2012 at 08:23:52AM +0200, Stéphane Bugat wrote:
> One last question: I'd like to sync 'surname', 'firstname'
> attributes and email relations of both Person and CWUser in one and
> unique hook. For that I propose to select with a Hook.__select__ &
> (is_instance('Person') | is_instance('CWUser')) and to select on
> events ('after_add_entity', 'after_update_entity').
is_instance('Person', 'CWUser') would be better
> Is there a way to retrieve the selected event and instance in the
> __call__() method of the hook?
According to http://docs.cubicweb.org/devrepo/repo/hooks I would say
you are looking for self.entity in YourOwnHook.__call__()
logilab.fr - services en informatique scientifique et gestion de connaissances
More information about the Cubicweb