Re: [SQLObject] Temporary Objects (I'm going in!)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ian B. <ia...@co...> - 2003-04-29 22:14:44
|
On Tue, 2003-04-29 at 12:17, Luke Opperman wrote: > > from Transaction import Transaction > > from invoicing import Client > > t = Transaction() > > c = Client(1) > > t.insertObject(c) > > c.address1 = "100 New Street" > > t.saveChanges() I think t.insertObject(c) isn't a good idea. Client(1) is an object that may be in use in several places, and is presumed to be transparently persistent. When you put it into the transaction you've made temporary for all users of the object. Bad bugs will follow. At least in threaded situations. This is why I think the object has to be instantiated as part of the transaction, or perhaps copied if you don't like instantiation... t = Transaction() c = Client(1) ctmp = c.inTransaction(t) # or... ctmp = Client(1, t) Ian |