Bugfix: error in check for compress file creation
This commit is contained in:
parent
363bd68281
commit
32d09637c8
13
iwla.py
13
iwla.py
|
@ -132,7 +132,7 @@ class IWLA(object):
|
||||||
|
|
||||||
ANALYSIS_CLASS = 'HTTP'
|
ANALYSIS_CLASS = 'HTTP'
|
||||||
API_VERSION = 1
|
API_VERSION = 1
|
||||||
IWLA_VERSION = '0.5-dev'
|
IWLA_VERSION = '0.6'
|
||||||
|
|
||||||
def __init__(self, logLevel, dry_run):
|
def __init__(self, logLevel, dry_run):
|
||||||
self.meta_infos = {}
|
self.meta_infos = {}
|
||||||
|
@ -572,34 +572,33 @@ class IWLA(object):
|
||||||
|
|
||||||
self.display.addPage(page)
|
self.display.addPage(page)
|
||||||
|
|
||||||
def _compressFile(self, build_time, root, filename):
|
def _compressFile(self, root, filename):
|
||||||
path = os.path.join(root, filename)
|
path = os.path.join(root, filename)
|
||||||
gz_path = path + '.gz'
|
gz_path = path + '.gz'
|
||||||
|
|
||||||
self.logger.debug('Compress %s => %s' % (path, gz_path))
|
self.logger.debug('Compress %s => %s' % (path, gz_path))
|
||||||
|
|
||||||
if not os.path.exists(gz_path) or\
|
if not os.path.exists(gz_path) or\
|
||||||
os.stat(path).st_mtime >= build_time:
|
os.stat(path).st_mtime > os.stat(gz_path).st_mtime:
|
||||||
if self.dry_run: return
|
if self.dry_run: return
|
||||||
with open(path, 'rb') as f_in, gzip.open(gz_path, 'wb') as f_out:
|
with open(path, 'rb') as f_in, gzip.open(gz_path, 'wb') as f_out:
|
||||||
f_out.write(f_in.read())
|
f_out.write(f_in.read())
|
||||||
|
|
||||||
def _compressFiles(self, build_time, root):
|
def _compressFiles(self, root):
|
||||||
if not conf.compress_output_files: return
|
if not conf.compress_output_files: return
|
||||||
for rootdir, subdirs, files in os.walk(root, followlinks=True):
|
for rootdir, subdirs, files in os.walk(root, followlinks=True):
|
||||||
for f in files:
|
for f in files:
|
||||||
for ext in conf.compress_output_files:
|
for ext in conf.compress_output_files:
|
||||||
if f.endswith(ext):
|
if f.endswith(ext):
|
||||||
self._compressFile(build_time, rootdir, f)
|
self._compressFile(rootdir, f)
|
||||||
break
|
break
|
||||||
|
|
||||||
def _generateDisplay(self):
|
def _generateDisplay(self):
|
||||||
self._generateDisplayDaysStats()
|
self._generateDisplayDaysStats()
|
||||||
self._callPlugins(conf.DISPLAY_HOOK_DIRECTORY)
|
self._callPlugins(conf.DISPLAY_HOOK_DIRECTORY)
|
||||||
self._generateDisplayWholeMonthStats()
|
self._generateDisplayWholeMonthStats()
|
||||||
build_time = time.mktime(time.localtime())
|
|
||||||
self.display.build(conf.DISPLAY_ROOT)
|
self.display.build(conf.DISPLAY_ROOT)
|
||||||
self._compressFiles(build_time, conf.DISPLAY_ROOT)
|
self._compressFiles(conf.DISPLAY_ROOT)
|
||||||
|
|
||||||
def _createEmptyStats(self):
|
def _createEmptyStats(self):
|
||||||
stats = {}
|
stats = {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user