diff options
Diffstat (limited to '')
-rwxr-xr-x | index.py | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -39,13 +39,23 @@ def handle_sql(handler): return h # +# Check for mobile (at least somewhat) +# +mobile_checks = ["J2ME", "Opera Mini"] +def handle_mobile(): + ua = web.ctx.env.get("HTTP_USER_AGENT", "") + + web.ctx.is_mobile = any((x in ua) for x in mobile_checks) + +# # The App # app = web.application(urls, globals()) app.notfound = controller.FourOhFour.catch -# add orm processor +# add processors app.add_processor(handle_sql) +app.add_processor(web.loadhook(handle_mobile)) # debug for the moment web.config.debug = True |