diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2012-01-15 11:12:11 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2012-01-15 11:12:11 +0100 |
commit | dc36e320ef4d90b0bf802c6b54877971e2249d1a (patch) | |
tree | fa0f23bc0e0920c77587135cf1e4ab92e0e1275d /index.py | |
parent | c2b7abf89ec9747cf8a32c2d1480833fc94fca09 (diff) | |
download | kosten-dc36e320ef4d90b0bf802c6b54877971e2249d1a.tar.gz kosten-dc36e320ef4d90b0bf802c6b54877971e2249d1a.tar.bz2 kosten-dc36e320ef4d90b0bf802c6b54877971e2249d1a.zip |
Do not load JS for mobile browsers
Diffstat (limited to 'index.py')
-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 |