Changeset 387:580db757e0eb in documentViewer
- Timestamp:
- Oct 29, 2010, 12:53:45 PM (15 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentViewer.py
r386 r387 52 52 return s 53 53 54 def getBrowserType(self): 55 """get browser type object""" 56 if self.REQUEST.SESSION.has_key('browserType'): 57 return self.REQUEST.SESSION['browserType'] 58 else: 59 bt = browserCheck(self) 60 self.REQUEST.SESSION.set('browserType', bt) 61 logging.debug("documentViewer (BROWSER TYPE) bt %s"%bt) 62 return bt 54 def browserCheck(self): 55 """check the browsers request to find out the browser type""" 56 bt = {} 57 ua = self.REQUEST.get_header("HTTP_USER_AGENT") 58 bt['ua'] = ua 59 bt['isIE'] = False 60 bt['isN4'] = False 61 if string.find(ua, 'MSIE') > -1: 62 bt['isIE'] = True 63 else: 64 bt['isN4'] = (string.find(ua, 'Mozilla/4.') > -1) 65 66 try: 67 nav = ua[string.find(ua, '('):] 68 ie = string.split(nav, "; ")[1] 69 if string.find(ie, "MSIE") > -1: 70 bt['versIE'] = string.split(ie, " ")[1] 71 except: pass 72 73 bt['isMac'] = string.find(ua, 'Macintosh') > -1 74 bt['isWin'] = string.find(ua, 'Windows') > -1 75 bt['isIEWin'] = bt['isIE'] and bt['isWin'] 76 bt['isIEMac'] = bt['isIE'] and bt['isMac'] 77 bt['staticHTML'] = False 78 79 return bt 63 80 64 81 … … 310 327 return ret 311 328 312 329 def getBrowser(self): 330 """getBrowser the version of browser """ 331 bt = browserCheck(self) 332 logging.debug("XXXXXXXXXXXXXXXX: %s"%bt) 333 return bt 334 313 335 def findDigilibUrl(self): 314 336 """try to get the digilib URL from zogilib"""
Note: See TracChangeset
for help on using the changeset viewer.