From eefd1e96e7fdabf2a7b19b8f6372dac0bdc56d34 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 3 Dec 2011 17:49:26 +0100 Subject: [PATCH] obscure browsers and operating systems --- pandora/user/models.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pandora/user/models.py b/pandora/user/models.py index 4a1830780..233a09f6b 100644 --- a/pandora/user/models.py +++ b/pandora/user/models.py @@ -44,9 +44,18 @@ class SessionData(models.Model): def parse_data(self): if self.useragent: self.browser = 'Unknown' - for browser in ('Webkit', 'Safari', 'Chrome', 'Firefox', 'Safari Mobile', 'Opera'): + for browser in ( + 'Internet Explorer' + 'Webkit', + 'Safari', + 'Chrome', + 'Firefox', + 'Safari Mobile', + 'Opera', + ): if { 'Safari Mobile': 'Mobile/', + 'Internet Explorer': 'MSIE', }.get(browser, browser) in self.useragent: self.browser = browser @@ -54,6 +63,10 @@ class SessionData(models.Model): if { }.get(system, system) in self.useragent: self.system = system + if 'Mobile/' in self.useragent and 'Safari' in self.useragent and \ + ('iPhone' in self.useragent or 'iPad' in self.useragent): + self.system = 'iOS' + if self.ip: try: g = GeoIP()