Hello,
I attempted trial and error (and poked around some code), but am not
able to figure out the intended method of doing transactions in a TG 2
application.
import transaction
def parent():
try:
urec = User(name='test', ...)
DBSession.add(urec)
# transaction.doom() works if placed here before the query
newrec = DBSession.query(User).filter(User.name='test', ...
blah)
child_routine_that_does_dependent_DB_ops() # DB op works but
routine raises an exception for TESTING
except Exception, e:
transaction.doom() # Does not remove the urec record from DB
What is the correct method for doing transaction rollbacks? Does the
rollback not occur after a successful query? Do I need to modify some
config item?
(I tried setting DBSession.autoflush = False,
transaction.manager.abort(), DBSession.rollback(), but none of these
work).
Thanks!
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en.