Ian Bicking
-
2004-03-03
- status: open --> closed-fixed
When creating a Object with SQLObject.new
(...,connection= conn.transaction() ),
SQLObject._SO_perConnection is not set to TRUE. Thus
a newly created object does not respect the connection.
When calling SQLObject(1,connection = conn.transaction
() ) _SO_perConnection is set by the _init method
(because connection is not None), when calling the .new
() method _init is only called with the id thus connection
is None and _SO_perConnection is not set.
I think the following solves the problem:
def new(cls, **kw):
if kw.has_key('connection'):
inst = cls(CreateNewSQLObject, connection=kw
['connection'])
del kw['connection']
inst._SO_perConnection = True
else:
inst = cls(CreateNewSQLObject)
rolf@noxs.nl