Hash: SHA1

Jim Fulton wrote:
> Julien Anguenot wrote:
>> I would like to order the before commit hooks on a transaction by being
>> able to specify an order for a subscriber at registration time. For the
>> moment, they are called in the order they've been registred.
>> What do you think ?
> What is the motivation for this?  Can you give any use cases?

sure. It was a YAGNI driven proposal. We used the beforeCommitHook
support since the beginning on CPS for content indexation optimizations.
For this, we defined an indexation manager registred as a before commit
hook assuring us that, for a given content, it would be indexed only
*once* per transaction (including security indexation). FYI, it's not
the current behavior at all on a stock CMF. (You can get until 5 times
reindexation for the same object and this is really a pb when you get a
*really huge* catalog, SQL or not) Then, recently I wanted to use the
same pattern for the events received by the system that we were using
for user notifications. So same idea, an event manager hook registred as
before commit hook. Problem : no way of being sure that the event
manager would be called *after* the indexation manager because I wanted
to be sure to get the potential events the indexation manager could
raise. The idea is pretty clear, isn't it ?

Feel free to ask for CPS code pointers on this.

> I'm -1 on this because it adds complexity to something that I think
> should be simple.  

I disagree, it doesn't add that much complexity. Basically, one more
'order' argument and adding the hook in a sorted tuple.

> It feels like something that is likely to be
> missused. 

Not sure I get this.

> I do have an open mind though.


> Unfortunately, I won't see your reply for over a week.  I'd
> prefer not to see this added to the trunk until we've had a chance
> to discuss it a bit more.

I did the job in a branch following Tim's advices for the implementation
 last week and he actually merged the devel branch yesterday.


- --
Julien Anguenot | Nuxeo R&D (Paris, France)
CPS Platform : http://www.cps-project.org
Zope3 / ECM   : http://www.z3lab.org
mail: anguenot at nuxeo.com; tel: +33 (0) 6 72 57 57 66
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to