[ZODB-Dev] Pluggable transactions logic
Steve Alexander
steve@cat-box.net
Sat, 28 Jul 2001 11:00:47 +0100
Chris Withers wrote:
>
> class MyObj(PortalContent): # My content storage class pass
>
> def myMethod(obj) obj.portal_catalog.catalog_object(obj)
>
> registerAgent(myMethod,[MyObj],COMMIT,100)
>
> The first argument is the method to be called.
>
> The second argument is a list of classes. This indicates that this
> method should be called when objects of that class are committed.
> Maybe that could be interfaces as well/instead? If this list is
> empty, the method gets called for all types of object.
>
> COMMIT is an integer constant indicating at what point in the
> transaction myMethod gets called.
>
> 100 is the priority. Methods are called in order of their priority.
>
> ...but I don't know enough about everyone elses use cases to try and
> give a more complete API...
Another difference between what you want here, and what I implemented in
TransactionAgents, is that when you register a Transaction Agent, the
registration lasts only for that one transaction.
It looks like you want to register something with the transaction
machinery of the ZODB for all subsequent transactions, until you
unregister it.
In which case, I see more what you're getting at now. I was confused by
the method name "registerAgent". I guess (in my terminology) it should
be "registerPlugIn".
I guess the integer value is to allow a variety of plug-ins to coexist.
As far as I can tell, things wouldn't need to register with your stuff
per-transaction, so you wouldn't need other methods added to the
Transaction class.
--
Steve Alexander
Software Engineer
Cat-Box limited