diff options
Diffstat (limited to '')
-rwxr-xr-x | index.py | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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 |