[Zope] SQLSession Transaction.py.patc

Duncan Booth duncan@rcp.co.uk
Tue, 3 Apr 2001 09:26:33 +0100


<color><param>7F00,0000,0000</param>> Thanks a bunch, Duncan. This works almost perfectly. There is

> one small correction, though: the _prepend method you give prevents

> regular registration from any later object, because self._append is

> defined as self._objects.append earlier on; this means that further

> _append() calls will append to the wrong sequence.

</color>Oops. Thanks for that correction. The code I was using was from 
way back when I first started using SQLSession. I guess at some 
point the author must have accidentally revealed his patch, 
although I can't remember where or when.


<color><param>7F00,0000,0000</param>> 

> A more correct version is:

> 

>      def _prepend(self, object):

>          self._objects[0:0] = [object]

> 

</color>Even simpler when it comes down to it would be to lose the 
_prepend method altogether and replace:

    self._prepend(object)

with your line or with

    self._objects.insert(0, object)


However a better solution in the long run might be to move existing 
code over to Core session tracking.


<nofill>
-- 
Duncan Booth                                             duncan@dales.rmplc.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
http://dales.rmplc.co.uk/Duncan