I have a controller method that looks something like this:
@tg.expose()
def foo(self, etc..):
result="ok"
trans = session.create_transaction()
try:
create some records, etc...
except:
result="problem..."
if(result=="ok"):
try:
do some file ops.
except:
result="problem..."
if(result=="ok"):
trans.commit()
else:
trans.rollback()
return result
I'm running into the problem discussed here:
http://groups.google.com/group/sqlalchemy/browse_thread/thread/4236f9...
I'm getting an exception that indicates that the transaction is
inactive if either try block raises an exception.
Apparently, the TG @expose decorator wraps the session in a
transaction (sa_wrt) within which the controller method runs. When
the controller raises an exception and rolls back, the commit() that
happens after the controller code block is trying to commit an already
rolled back transaction.
There was a fairly detailed and lengthy discussion in this group
recently involving the use of a 'special' decorator for methods that
need to have explicit transaction control, like mine above.
Is this fixed in 1.01b? Can anyone point me to explicit documentation
or a simple example about how to do this? My site is going live today
and this would be highly appreciated.
Thanks,
JJ
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---