From 81e7480e7526025ce27f0ca234104b039631cf3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Mon, 3 May 2010 23:11:52 +0200 Subject: started modelling --- index.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'index.py') 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 @@ -11,12 +12,32 @@ urls = ( "/(.*)", controller.Page ) +# +# 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 -- cgit v1.2.3