[Zope-Coders] Zope test results

Steve Alexander steve@cat-box.net
Wed, 12 Jun 2002 18:02:27 +0100


Shane Hathaway wrote:
> Jeremy Hylton wrote:
> 
>>>>>>> "SH" == Shane Hathaway <shane@zope.com> writes:
>>>>>>
>>   SH> 1) Connection.register(object) will set the _p_jar (and perhaps
>>   SH>    _p_oid)
>>   SH> of the object, if it has not already been set, then call
>>   SH> get_transaction().register(object).  cPersistence will call
>>   SH> _p_jar.register() instead of get_transaction().register().
>>
>>   SH> 2) Connection.register(object) will set the _p_jar (and perhaps
>>   SH>    _p_oid)
>>   SH> of the object.  It will simply return.  cPersistence will not
>>   SH> change.
>>
>>   SH> I'd really like to see option 1, since in my own ZODB
>>   SH> experiments I've frequently had to patch Transaction.register().
>>   SH> If I could just override Connection.register() in my subclass,
>>   SH> the code would be much cleaner.  I think the performance impact
>>   SH> would be very small.
>>
>> I had been thinking about option 2, but I hadn't given it much
>> thought.  What changes have you had to make to Transaction.register()?
> 
> 
> In one experiment, I provided a way to perform conflict resolution of an 
> entire branch of objects (as opposed to single-object conflict 
> resolution like we have today).  I used a custom Connection type for all 
> objects in a part of the database.  I had to patch 
> Transaction.register() to channel object change notifications to a 
> different place.  If cPersistence called connection.register() instead, 
> I would have been able to simply override instead.
 >
> Hmm, come to think of it, I guess that's the only experiment that needed 
> this. ;-) 

The TransactionAgents product, which is used in the field, dynamically 
patches Transaction.register().

However, I've had a word with the maintainer ;-) and they can release an 
updated version for Zope 2.6, provided someone explains the new places 
to hook things up.

--
Steve Alexander