From: Ants Aasma Date: Sun, 20 Jan 2008 03:39:43 +0000 (+0000) Subject: example of using try-catch to do transaction commit/rollback was wrong in the docs X-Git-Tag: rel_0_4_3~93 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f645c0a420c2253f13d04b48a6037cbd52b75e2f;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git example of using try-catch to do transaction commit/rollback was wrong in the docs --- diff --git a/doc/build/content/session.txt b/doc/build/content/session.txt index e17987cf53..d44bef50d9 100644 --- a/doc/build/content/session.txt +++ b/doc/build/content/session.txt @@ -460,10 +460,10 @@ Alternatively, a transaction can be begun explicitly using `begin()`: item2 = sess.query(Item).get(2) item1.foo = 'bar' item2.bar = 'foo' + sess.commit() except: sess.rollback() raise - sess.commit() Session also supports Python 2.5's with statement so that the example above can be written as: