diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2012-01-10 22:01:37 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2012-01-10 22:01:37 +0100 |
commit | a5c0cd1a0f496325035fbd3f3cbb8b81e7648301 (patch) | |
tree | 50cf8500662a618b2c2d2ff7122cec5b69e50186 | |
parent | 77817e08eb237c207cc93d9545c61fb30e0059a9 (diff) | |
download | kosten-a5c0cd1a0f496325035fbd3f3cbb8b81e7648301.tar.gz kosten-a5c0cd1a0f496325035fbd3f3cbb8b81e7648301.tar.bz2 kosten-a5c0cd1a0f496325035fbd3f3cbb8b81e7648301.zip |
Fix bug that prevents closing sql-connections
Diffstat (limited to '')
-rw-r--r-- | controller.py | 3 | ||||
-rwxr-xr-x | index.py | 13 | ||||
-rw-r--r-- | model.py | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/controller.py b/controller.py index ea8be5b..5056306 100644 --- a/controller.py +++ b/controller.py @@ -193,6 +193,7 @@ class ConstAdd: else: e.prev = None + web.ctx.orm.commit() raise web.seeother("/const/%s" % e.id) else: return render(self.template, form = f) @@ -219,7 +220,7 @@ class ConstAdd: cur = self.get_expense() if cur.id is None: # empty - session.expunge(cur) + web.ctx.orm..expunge(cur) else: filter = sql.or_(CE.next == cur, filter) filter = sql.and_(filter, CE.id != cur.id) @@ -24,18 +24,19 @@ urls = ( # ORM # def handle_sql(handler): - web.ctx.orm = session = model.session + web.ctx.orm = model.session try: - return handler() + h = handler() except web.HTTPError: - session.commit() - raise + web.ctx.orm.commit() + raise except: - session.rollback() + web.ctx.orm.rollback() raise else: - session.commit() + web.ctx.orm.commit() + return h # # The App @@ -7,7 +7,7 @@ import datetime from functools import partial from collections import namedtuple -__all__ = ["Category", "SingleExpense", "ConstExpense", "CatExpense", "MonthExpense", "session"] +__all__ = ["Category", "SingleExpense", "ConstExpense", "CatExpense", "MonthExpense"] # # DB Setup |