Mercurial > hg > documentViewer
comparison SrvTxtUtils.py @ 585:83eeed69793f
new annotator layer for images.
author | casties |
---|---|
date | Tue, 13 Nov 2012 17:33:34 +0100 |
parents | 2fe04b61ed95 |
children | c57d80a649ea |
comparison
equal
deleted
inserted
replaced
584:011905457a5f | 585:83eeed69793f |
---|---|
9 import urllib | 9 import urllib |
10 import urllib2 | 10 import urllib2 |
11 import logging | 11 import logging |
12 | 12 |
13 | 13 |
14 srvTxtUtilsVersion = "1.5.1" | 14 srvTxtUtilsVersion = "1.6" |
15 | 15 |
16 def getInt(number, default=0): | 16 def getInt(number, default=0): |
17 """returns always an int (0 in case of problems)""" | 17 """returns always an int (0 in case of problems)""" |
18 try: | 18 try: |
19 return int(number) | 19 return int(number) |
130 self.lmt = float(stat_info[stat.ST_MTIME]) or time.time() | 130 self.lmt = float(stat_info[stat.ST_MTIME]) or time.time() |
131 self.lmh = rfc1123_date(self.lmt) | 131 self.lmh = rfc1123_date(self.lmt) |
132 # call original method | 132 # call original method |
133 return ImageFile.index_html(self, REQUEST, RESPONSE) | 133 return ImageFile.index_html(self, REQUEST, RESPONSE) |
134 | 134 |
135 | |
136 def getBrowserType(self): | |
137 """check the browsers request to find out the browser type""" | |
138 bt = {} | |
139 ua = self.REQUEST.get_header("HTTP_USER_AGENT") | |
140 bt['ua'] = ua | |
141 bt['isIE'] = False | |
142 bt['isN4'] = False | |
143 if string.find(ua, 'MSIE') > -1: | |
144 bt['isIE'] = True | |
145 else: | |
146 bt['isN4'] = (string.find(ua, 'Mozilla/4.') > -1) | |
147 | |
148 try: | |
149 nav = ua[string.find(ua, '('):] | |
150 ie = string.split(nav, "; ")[1] | |
151 if string.find(ie, "MSIE") > -1: | |
152 bt['versIE'] = string.split(ie, " ")[1] | |
153 except: pass | |
154 | |
155 bt['isMac'] = string.find(ua, 'Macintosh') > -1 | |
156 bt['isWin'] = string.find(ua, 'Windows') > -1 | |
157 bt['isIEWin'] = bt['isIE'] and bt['isWin'] | |
158 bt['isIEMac'] = bt['isIE'] and bt['isMac'] | |
159 bt['staticHTML'] = False | |
160 | |
161 return bt | |
162 | |
163 |