[Cubicweb] Workflows and Hooks

St├ęphane Bugat stephane.bugat at free.fr
Wed Aug 1 11:17:06 CEST 2012

Dear all

I'm trying to capture the moment when a workflow changes its status to perform a relation creation.
To be more specific, I have created a workflowable entity, 'ContactNotification', and I want that when the corresponding status of this entity becomes "accepted", a link is created between the 2 persons (the one that created the contact notification, and the targeted person by this notification).

For that, I've tried to create a hook selecting instances of 'State' on events 'after_update_entity', get the workflowable entity with a ``related('in_state', 'object')``, then get both persons involved, and finally set a symmetric relation between both of them (with something like ``sender.set_relations(in_contact_with=receiver)``...).

Tests performed shown that once a ContactNotification is accepted, the hook is not called at all (I've traced it using ugly *print* statements in the __call__ of the hook)...

My 2 questions are:
  1. Why this kind of hook is not called on such entities?
  2. Is there another way to do it?


More information about the Cubicweb mailing list