Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed a bug in settings the redirection of the ipad

  • Loading branch information...
commit 3aa560ae1f325ad1c57d24e9715e0e62f8d53350 1 parent 7bd06c1
@jjanssen jjanssen authored
Showing with 4 additions and 7 deletions.
  1. +4 −7 browsecap/middleware.py
View
11 browsecap/middleware.py
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.