Gokmen Gorgen avatar Gokmen Gorgen committed 3a48183

old code. remove it.

Comments (0)

Files changed (1)

djangominimizer/middleware.py

-import re
-
-
-class MobileDetectionMiddleware(object):
-    user_agents_test_match = (
-        "w3c ", "acs-", "alav", "alca", "amoi", "audi",
-        "avan", "benq", "bird", "blac", "blaz", "brew",
-        "cell", "cldc", "cmd-", "dang", "doco", "eric",
-        "hipt", "inno", "ipaq", "java", "jigs", "kddi",
-        "keji", "leno", "lg-c", "lg-d", "lg-g", "lge-",
-        "maui", "maxo", "midp", "mits", "mmef", "mobi",
-        "mot-", "moto", "mwbp", "nec-", "newt", "noki",
-        "xda",  "palm", "pana", "pant", "phil", "play",
-        "port", "prox", "qwap", "sage", "sams", "sany",
-        "sch-", "sec-", "send", "seri", "sgh-", "shar",
-        "sie-", "siem", "smal", "smar", "sony", "sph-",
-        "symb", "t-mo", "teli", "tim-", "tosh", "tsm-",
-        "upg1", "upsi", "vk-v", "voda", "wap-", "wapa",
-        "wapi", "wapp", "wapr", "webc", "winw", "winw",
-        "xda-")
-    user_agents_test_search = u"(?:%s)" % u'|'.join((
-        'up.browser', 'up.link', 'mmp', 'symbian', 'smartphone', 'midp',
-        'wap', 'phone', 'windows ce', 'pda', 'mobile', 'mini', 'palm',
-        'netfront', 'opera mobi'))
-    # user_agents_exception_search = u"(?:%s)" % u'|'.join((
-    #     'ipad'))
-    http_accept_regex = re.compile(
-        "application/vnd\.wap\.xhtml\+xml", re.IGNORECASE)
-
-    def __init__(self):
-        user_agents_test_match = r'^(?:%s)' % '|'.join(
-            self.user_agents_test_match)
-        self.user_agents_test_match_regex = re.compile(
-            user_agents_test_match, re.IGNORECASE)
-        self.user_agents_test_search_regex = re.compile(
-            self.user_agents_test_search, re.IGNORECASE)
-        # self.user_agents_exception_search_regex = re.compile(
-        #     self.user_agents_exception_search, re.IGNORECASE)
-
-    def process_request(self, request):
-        user_agent = request.META.get('HTTP_USER_AGENT', '')
-        is_mobile = False
-
-        # Test common mobile values.
-        # if self.user_agents_test_search_regex.search(user_agent) and \
-        #     not self.user_agents_exception_search_regex.search(user_agent):
-        if self.user_agents_test_search_regex.search(user_agent):
-            is_mobile = True
-        else:
-            # Nokia like test for WAP browsers: http://goo.gl/ry23y
-            http_accept = request.META.get('HTTP_ACCEPT', '')
-            if self.http_accept_regex.search(http_accept):
-                is_mobile = True
-
-        if not is_mobile:
-            # Now we test the user_agent from a big list.
-            if self.user_agents_test_match_regex.match(user_agent):
-                is_mobile = True
-
-        request.minimizer_mobile = is_mobile
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.