Is there a way to do implicit transactions natively in SQLObject?
Following some examples, I made a wrapper for "UPDATE" but need a
generic built-in approach.
def update(sobject, data):
o = sobject
while o != None:
o.sqlmeta.cacheValues = False
o = getattr(o, '_parent')
old_conn = so.sqlhub.getConnection()
conn = old_conn.transaction()
so.sqlhub.threadConnection = conn
try:
try:
sobject.set(**data)
except:
conn.rollback()
raise
else:
conn.commit()
o = sobject
while o != None:
o.sync()
o = getattr(o, '_parent')
finally:
so.sqlhub.threadConnection = old_conn
--
jt