Permalink
Browse files

fixed a bug in settings the redirection of the ipad

  • Loading branch information...
jjanssen committed Jan 28, 2011
1 parent 7bd06c1 commit 3aa560ae1f325ad1c57d24e9715e0e62f8d53350
Showing with 4 additions and 7 deletions.
  1. +4 −7 browsecap/middleware.py
View
@@ -14,13 +14,12 @@ class MobileRedirectMiddleware(object):
def process_request(self, request):
if not getattr(settings, 'MOBILE_DOMAIN', False):
return
-
+
# Cookie settings
max_age = getattr(settings, 'MOBILE_COOKIE_MAX_AGE', DEFAULT_COOKIE_MAX_AGE)
expires_time = time.time() + max_age
expires = cookie_date(expires_time)
-
# test for browser return
if (
# is mobile?
@@ -66,10 +65,8 @@ def process_request(self, request):
def redirect_ipad(self, user_agent):
- if not getattr(settings, 'BROWSECAP_REDIRECT_IPAD', True):
- return False
- else:
+ if not getattr(settings, 'BROWSECAP_REDIRECT_IPAD'):
match = re.search('iPad', user_agent, re.I)
- if not getattr(settings, 'BROWSECAP_REDIRECT_IPAD', True) and match:
+ if match:
return False
- return True
+ return True

0 comments on commit 3aa560a

Please sign in to comment.