[TransWarp] __getitem__ on DM requires active transaction

Roch'e Compaan roche at upfrontsystems.co.za
Mon Dec 23 07:02:48 EST 2002


On Mon, Dec 23, 2002 at 12:33:34PM -0500, Phillip J. Eby wrote:
> At 06:59 PM 12/23/02 +0200, Roch? Compaan wrote:
> >Hi Philip
> >
> >I had a look at the data_managers.py code in the storage package and
> >something puzzles me.
> >
> >In the __getitem__ method of a QueryDM there is a call to
> >self.joinedTxn.  This method will raise an exception if one is not
> >already in a transaction (line 151 in transactions.py):
> >
> >        elif not self.isActive():
> >            raise exceptions.OutsideTransaction
> >
> >What if I want to retrieve an object from a DataManager and I am not in
> >a transaction? Surely one doesn't have to be in a transaction if you
> >simply want to retrieve an object?
> 
> In your DM subclass, set:
> 
> resetStatesAfterTxn = False

I actually want the cache to be flushed between transactions - I just
didn't think object retrieval required a transaction and it seems quite
tedious to manually start a transaction whenever I want to
retrieve something whereas "save", "new" and "delete" operations can
automatically start a transactions.

-- 
Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za



More information about the PEAK mailing list