I was told in another (private) email thread, that I could simply
prefix the dburi in the config file with 'notrans_' and it would turn
off the auto-transactions for ALL methods (which is basically what I
want, I think).

so, for my dburi, I would have:
sqlalchemy.dburi="notrans_mysql://root:@localhost:3306/vor"

I haven't had time to try this yet but would appreciate any info.
thanks,
J


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
-~----------~----~----~----~------~----~------~--~---

Reply via email to