Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20327/SQLObject
Modified Files:
SQLObject.py
Log Message:
I wrote a unit test to show that, when using a transaction to create a new
object, its ForeignKey objects were not using that same connection (which
they should have.) Daniel Savard implemented the fix in SQLObject.
I'm also deliberately checking in a broken test that demonstrates how we want
instance validation to work (confirmed with Ian), in the hopes that a broken
test will annoy someone enough to go in and implement in lieu of me/us having
the time to do so. :)
Index: SQLObject.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/SQLObject.py,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** SQLObject.py 4 Dec 2003 16:46:31 -0000 1.66
--- SQLObject.py 11 Feb 2004 16:25:38 -0000 1.67
***************
*** 838,843 ****
# Passing None for the ID tells __new__ we want to create
# a new object.
if kw.has_key('connection'):
! inst = cls(CreateNewSQLObject, connection=kw['connection'])
del kw['connection']
else:
--- 838,845 ----
# Passing None for the ID tells __new__ we want to create
# a new object.
+ connection = None
if kw.has_key('connection'):
! connection = kw['connection']
! inst = cls(CreateNewSQLObject, connection=connection)
del kw['connection']
else:
***************
*** 895,903 ****
# Then we finalize the process:
! inst._SO_finishCreate(id)
return inst
new = classmethod(new)
! def _SO_finishCreate(self, id=None):
# Here's where an INSERT is finalized.
# These are all the column values that were supposed
--- 897,905 ----
# Then we finalize the process:
! inst._SO_finishCreate(id, connection=connection)
return inst
new = classmethod(new)
! def _SO_finishCreate(self, id=None, connection=None):
# Here's where an INSERT is finalized.
# These are all the column values that were supposed
***************
*** 920,924 ****
cache = self._connection.cache
cache.created(id, self.__class__, self)
! self._init(id)
def _SO_getID(self, obj):
--- 922,926 ----
cache = self._connection.cache
cache.created(id, self.__class__, self)
! self._init(id, connection=connection)
def _SO_getID(self, obj):
|