iwla

iwla Commit Details

Date:2014-12-10 21:41:22 (6 years 7 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:1a5f65bdc2e485afe5e67729a340a4d486f48fa8
Parents: 6d62f2137389f22688214d6c31b0d78cbe6d5ad9
Message:Try to fix UTC problem

Changes:
Mdefault_conf.py (1 diff)
Miwla.py (2 diffs)

File differences

default_conf.py
2323
2424
2525
26
27
26
2827
2928
3029
'"$http_referer" "$http_user_agent"'
# Time format used in log format
# TOFIX UTC
time_format = '%d/%b/%Y:%H:%M:%S +0100'
time_format = '%d/%b/%Y:%H:%M:%S %z'
# Hooks that are loaded at runtime (only set names without path and extensions)
pre_analysis_hooks = []
iwla.py
310310
311311
312312
313
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
314329
315330
316331
......
583598
584599
585600
586
601
587602
588603
589604
return True
def _decodeTime(self, hit):
hit['time_decoded'] = time.strptime(hit['time_local'], conf.time_format)
try:
hit['time_decoded'] = time.strptime(hit['time_local'], conf.time_format)
except ValueError, e:
if sys.version_info < (3, 2):
# Try without UTC value at the end (%z not recognized)
gmt_offset_str = hit['time_local'][-5:]
gmt_offset_hours = int(gmt_offset_str[1:3])*60*60
gmt_offset_minutes = int(gmt_offset_str[3:5])*60
gmt_offset = gmt_offset_hours + gmt_offset_minutes
hit['time_decoded'] = time.strptime(hit['time_local'][:-6], conf.time_format[:-3])
if gmt_offset_str[0] == '+':
hit['time_decoded'] = time.localtime(time.mktime(hit['time_decoded'])+gmt_offset)
else:
hit['time_decoded'] = time.localtime(time.mktime(hit['time_decoded'])-gmt_offset)
else:
raise e
return hit['time_decoded']
def getDisplayIndex(self):
print '==> Load previous database'
self.meta_infos = self._deserialize(conf.META_PATH) or self._clearMeta()
if 'last_time' in self.meta_infos.keys():
if self.meta_infos['last_time']:
self.current_analysis = self._deserialize(self.getDBFilename(self.meta_infos['last_time'])) or self._clearVisits()
else:
self._clearVisits()

Archive Download the corresponding diff file

Branches

Tags