]> asedeno.scripts.mit.edu Git - bluechips.git/blobdiff - bluechips/lib/base.py
Fix division of currency
[bluechips.git] / bluechips / lib / base.py
index 8e7c20cfdfefe88a529456f2f335114ccf33250a..d04f98160d38c95a8e50171c704ae34378c37263 100644 (file)
@@ -52,14 +52,19 @@ def redirect_on_get(action):
     return redirect_on_get_wrap
 
 def render(name, *args, **kwargs):
-    if 'iPhone' in request.user_agent:
+    if any([x in request.user_agent for x in ('iPhone','webOS')]):
+        if 'use_non_mobile' in request.params:
+            session['use_non_mobile'] = (request.params['use_non_mobile'] ==
+                                         'yes')
         if session.get('use_non_mobile'):
             c.mobile_client = True
         else:
             try:
                 return render_mako('/mobile' + name, *args, **kwargs)
             except TopLevelLookupException:
-                pass
+                # If a mobile template doesn't exist for this page, don't show
+                # the 'use mobile interface' link.
+                c.mobile_client = False
     return render_mako(name, *args, **kwargs)
 
 __all__ = ['c', 'h', 'render', 'model', 'meta', '_', 'ungettext', 'N_',