[ZODB-Dev] Re: Ordering before commit hooks

Jim Fulton jim at zope.com
Wed Aug 31 10:28:54 EDT 2005


Florent Guillaume wrote:
> Jim Fulton wrote:
> 
>>> I don't understand why keeping the order paremeter is such a big deal ?
>>
>>
>> Because it clutters the ZODB API with something that is, fundamentally
>> application policy.
> 
> 
> Ok seen that way I agree. That's not the ZODB's job to decide what kind 
> of API is provided to enforce policy.
> 
> [...]
> 
>>  > But that only works if you have all the code in a single framework. If
>>  > Zope had a commit hook, and that CPS wanted to add another one that 
>> "ran
>>  > after Zope's", there would be no way to do it.
>>
>> Right, they have to agree on a common API.  With the order gimmic,
>> this is a ZODB API. It could as easily be a higher-level API.
>>
>> Since CPS in built on Zope, it could even be a Zope API that
>> CPS used.
> 
> 
> Ok. We can go back to a simple API for the ZODB before commit hook (the 
> one I originally checked in seems enough),

Great.  The discussion *did* yield some improvements to that API
that Tim would like to keep.

 > but we need to decide what
> kind of higher level API we provide at the Zope level.

Sounds good.

 > Would an integer order be ok there ?

If that's what you think you need, sure.  I'm mostly convinced that
you need something to go last.  I would recommend a facility
to say *that* directly, rather than indirectly through an integer.
(Of course, you don't really need any new machinery to say just that. :)

*If*, in addition, you need to order things and you think an integer
order is the way to go, then try it.  The risk is low because you'll
have your own separate framework that you can toss if you find it doesn't
work for you.

*I* would consider a more direct approach.  In Julien's example,
if you want TreeCacheManager to go after IndexationManager, then
I would have TreeCacheManager invoke IndexationManager. That's explicit
and much simpler and more predictable.  You can register both as
callbacks and have IndexationManager treat extra calls as noops.

> And where should the code go ?

I'd stick it in CPS (or z3ecm) for now until you've convined yourself
that it's useful. Then, if you want others to play, I'd be happy to
stick it somewhere in zope or zope.app.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the ZODB-Dev mailing list