diff options
Diffstat (limited to '')
-rwxr-xr-x | index.py | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -24,19 +24,22 @@ urls = ( # ORM # def handle_sql(handler): - web.ctx.orm = model.session - + web.ctx.orm = model.Session() + try: - h = handler() - except web.HTTPError: - web.ctx.orm.commit() - raise - except: - web.ctx.orm.rollback() - raise - else: - web.ctx.orm.commit() - return h + try: + h = handler() + except web.HTTPError: + web.ctx.orm.commit() + raise + except: + web.ctx.orm.rollback() + raise + else: + web.ctx.orm.commit() + return h + finally: + model.Session.remove() # # Check for mobile (at least somewhat) |