diff options
author | Scott Gilbertson <sng@luxagraf.net> | 2010-11-05 13:10:28 -0400 |
---|---|---|
committer | Scott Gilbertson <sng@luxagraf.net> | 2010-11-05 13:10:28 -0400 |
commit | 9e57763c069f9be1a13f592553a021efe1d0a785 (patch) | |
tree | bbf289073696b74054476edf0831454248bd591c /lib/mobile_middleware | |
parent | 654db6240968d9a7d9c0d9adddded0ab6f964a84 (diff) |
deleted tagging and mobile middleware from lib
Diffstat (limited to 'lib/mobile_middleware')
-rw-r--r-- | lib/mobile_middleware/__init__.py | 0 | ||||
-rw-r--r-- | lib/mobile_middleware/mobile_detect.py | 31 |
2 files changed, 0 insertions, 31 deletions
diff --git a/lib/mobile_middleware/__init__.py b/lib/mobile_middleware/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/lib/mobile_middleware/__init__.py +++ /dev/null diff --git a/lib/mobile_middleware/mobile_detect.py b/lib/mobile_middleware/mobile_detect.py deleted file mode 100644 index 6f5b998..0000000 --- a/lib/mobile_middleware/mobile_detect.py +++ /dev/null @@ -1,31 +0,0 @@ -from django.http import HttpResponseRedirect -import re -mobile_url = 'http://m.luxagraf.net/' -agents_list = [ - 'Nokia','bMOT','^LGE?b','SonyEricsson', - 'Ericsson','BlackBerry','DoCoMo','Symbian', - 'Windows CE','NetFront','Klondike','PalmOS', - 'PalmSource','portalmm','S[CG]H-','bSAGEM', - 'SEC-','jBrowser-WAP','Mitsu','Panasonic-', - 'SAMSUNG-','Samsung-','Sendo','SHARP-', - 'Vodaphone','BenQ','iPAQ','AvantGo', - 'Go.Web','Sanyo-','AUDIOVOX','PG-', - 'CDM[-d]','^KDDI-','^SIE-','TSM[-d]', - '^KWC-','WAP','^KGT [NC]','iPhone', -] -def is_mobile(user_agent): - for agent in agents_list: - if re.search(agent, user_agent): - return True - return False - -class MobileRedirect(object): - def process_request(self, request): - if not request.session.get('checked_ua', False): - if is_mobile(request.META['HTTP_USER_AGENT']): - request.session['checked_ua'] = True - return HttpResponseRedirect(mobile_url) - else: - # Make sure it doesn't try this again - request.session['checked_ua'] = True - return None
\ No newline at end of file |