summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindex.py12
-rw-r--r--templates/root.mako10
2 files changed, 17 insertions, 5 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
diff --git a/templates/root.mako b/templates/root.mako
index b744bbd..19af96e 100644
--- a/templates/root.mako
+++ b/templates/root.mako
@@ -2,10 +2,12 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <%block name="js">
- <script type="text/javascript" src=${"/static/js/jquery-1.4.2.js" | url}></script>
- <script type="text/javascript" src=${"/static/js/lib.js" | url}></script>
- </%block>
+ % if not w.ctx.is_mobile:
+ <%block name="js">
+ <script type="text/javascript" src=${"/static/js/jquery-1.4.2.js" | url}></script>
+ <script type="text/javascript" src=${"/static/js/lib.js" | url}></script>
+ </%block>
+ % endif
<link rel="shortcut icon" href=${"/static/images/currency.png" | url} type="image/icon">
<title><%block name="title">Kostenverwaltung</%block></title>
<%block name="style">