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):
inst = cls(CreateNewSQLObject, connection=kw
inst._SO_perConnection = True
inst = cls(CreateNewSQLObject)