so, which part of that thread has the magic bullet? I just need to turn off TG-created transactions altogether since I always want explicit commit/rollback statements. Is this possible/easy?
On Mar 26, 12:19 pm, Alberto Valverde <[EMAIL PROTECTED]> wrote: > On Mar 26, 2007, at 7:12 PM, Jesse James wrote: > > > > > > > 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... > > Broken link :( > > > > > > > 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. > > Have you seen this thread:http://tinyurl.com/2nvrhw? > > The mentioned patch got applied before 1.0.1 so it should be possible > to turn off automatic transactions for a specific method in which you > want to handle them yourself. > > Alberto --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

