summaryrefslogtreecommitdiff
path: root/index.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2012-01-15 11:12:11 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2012-01-15 11:12:11 +0100
commitdc36e320ef4d90b0bf802c6b54877971e2249d1a (patch)
treefa0f23bc0e0920c77587135cf1e4ab92e0e1275d /index.py
parentc2b7abf89ec9747cf8a32c2d1480833fc94fca09 (diff)
downloadkosten-dc36e320ef4d90b0bf802c6b54877971e2249d1a.tar.gz
kosten-dc36e320ef4d90b0bf802c6b54877971e2249d1a.tar.bz2
kosten-dc36e320ef4d90b0bf802c6b54877971e2249d1a.zip
Do not load JS for mobile browsers
Diffstat (limited to 'index.py')
-rwxr-xr-xindex.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/index.py b/index.py
index 1639fc4..a7d32d9 100755
--- a/index.py
+++ b/index.py
@@ -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