Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#14 new() method does not set _SO_perConnection

closed-fixed
nobody
None
5
2004-03-03
2003-12-02
Anonymous
No

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

Discussion

  • Ian Bicking
    Ian Bicking
    2004-03-03

    • status: open --> closed-fixed