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'
|
||||
API_VERSION = 1
|
||||
IWLA_VERSION = '0.5-dev'
|
||||
IWLA_VERSION = '0.6'
|
||||
|
||||
def __init__(self, logLevel, dry_run):
|
||||
self.meta_infos = {}
|
||||
|
@ -572,34 +572,33 @@ class IWLA(object):
|
|||
|
||||
self.display.addPage(page)
|
||||
|
||||
def _compressFile(self, build_time, root, filename):
|
||||
def _compressFile(self, root, filename):
|
||||
path = os.path.join(root, filename)
|
||||
gz_path = path + '.gz'
|
||||
|
||||
self.logger.debug('Compress %s => %s' % (path, gz_path))
|
||||
|
||||
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
|
||||
with open(path, 'rb') as f_in, gzip.open(gz_path, 'wb') as f_out:
|
||||
f_out.write(f_in.read())
|
||||
|
||||
def _compressFiles(self, build_time, root):
|
||||
def _compressFiles(self, root):
|
||||
if not conf.compress_output_files: return
|
||||
for rootdir, subdirs, files in os.walk(root, followlinks=True):
|
||||
for f in files:
|
||||
for ext in conf.compress_output_files:
|
||||
if f.endswith(ext):
|
||||
self._compressFile(build_time, rootdir, f)
|
||||
self._compressFile(rootdir, f)
|
||||
break
|
||||
|
||||
def _generateDisplay(self):
|
||||
self._generateDisplayDaysStats()
|
||||
self._callPlugins(conf.DISPLAY_HOOK_DIRECTORY)
|
||||
self._generateDisplayWholeMonthStats()
|
||||
build_time = time.mktime(time.localtime())
|
||||
self.display.build(conf.DISPLAY_ROOT)
|
||||
self._compressFiles(build_time, conf.DISPLAY_ROOT)
|
||||
self._compressFiles(conf.DISPLAY_ROOT)
|
||||
|
||||
def _createEmptyStats(self):
|
||||
stats = {}
|
||||
|
|
Loading…
Reference in New Issue
Block a user