On Jul 23, 10:16 am, [email protected] wrote:
> commit() or rollback() on the connection object as necessary, eg.
>
> con = g.pool.connection()
> cur = con.cursor()
>
> try:
>     # do some stuff
>     cur.execute("update .... ")
>     cur.execute("update .... ")
>     cur.execute("insert into .... ")
>     con.commit()
> except:
>     con.rollback()

I'll just shamelessly promote my little blog entry on a handy
decorator for implementing this idiom:

http://www.kylev.com/2009/05/22/python-decorators-and-database-idioms/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to