summaryrefslogtreecommitdiff
path: root/index.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-05-03 23:11:52 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-05-03 23:11:52 +0200
commit81e7480e7526025ce27f0ca234104b039631cf3d (patch)
tree3e75d4728e1c378e51c23f09ae842f3c6c585e98 /index.py
parentf0012811f8af8b1334b46781861a6dd3777ee392 (diff)
downloadkosten-81e7480e7526025ce27f0ca234104b039631cf3d.tar.gz
kosten-81e7480e7526025ce27f0ca234104b039631cf3d.tar.bz2
kosten-81e7480e7526025ce27f0ca234104b039631cf3d.zip
started modelling
Diffstat (limited to 'index.py')
-rwxr-xr-xindex.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/index.py b/index.py
index b91418d..d9e2e7d 100755
--- a/index.py
+++ b/index.py
@@ -2,6 +2,7 @@
import web
import controller
+import model
#
# URL Mappings
@@ -12,11 +13,31 @@ urls = (
)
#
+# ORM
+#
+def handle_sql(handler):
+ web.ctx.orm = session = model.session
+
+ try:
+ return handler()
+ except web.HTTPError:
+ session.commit()
+ raise
+ except:
+ session.rollback()
+ raise
+ else:
+ session.commit()
+
+#
# The App
#
app = web.application(urls, globals())
app.notfound = controller.FourOhFour
+# add orm processor
+app.add_processor(handle_sql)
+
# debug for the moment
web.config.debug = True