[SQLObject] Hung transactions on object creation
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Sidnei da S. <si...@aw...> - 2003-10-27 20:11:39
|
Howdy folks, I'm experiencing the following problem: When an object is created, if an exception happens inside new(), for example, a parameter which has no default is missing, postgres gets hung on 'idle in transaction' state. To fix it I made the following two small changes, though I'm not sure that it will do the right thing in all cases. Any better suggestion? Index: SQLObject.py =================================================================== RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/SQLObject.py,v retrieving revision 1.61 diff -u -r1.61 SQLObject.py --- SQLObject.py 24 Oct 2003 19:18:52 -0000 1.61 +++ SQLObject.py 27 Oct 2003 20:04:58 -0000 @@ -852,6 +852,7 @@ # If we don't get it, it's an error: if default is NoDefault: + inst._connection.transaction().rollback() raise TypeError, "%s did not get expected keyword argument %s" % (cls.__name__, repr(column.name)) # Otherwise we put it in as though they did pass # that keyword: @@ -876,6 +877,7 @@ try: getattr(cls, name) except AttributeError: + inst._connection.transaction().rollback() raise TypeError, "%s.new() got an unexpected keyword argument %s" % (cls.__name__, name) setattr(inst, name, value) -- Sidnei da Silva <si...@aw...> dreamcatching :: making your dreams come true http://awkly.org Real Users are afraid they'll break the machine -- but they're never afraid to break your face. |