Merge with remote:master

This commit is contained in:
Gregory Soutade 2014-12-19 18:06:46 +01:00
commit b9d13c9e19
3 changed files with 7 additions and 6 deletions

1
TODO
View File

@ -2,3 +2,4 @@ doc enhancement
Limit hits/pages/downloads by rate
Automatic tests
Free memory as soon as possible
Remove some IP from statistics

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
import os
# Default configuration

View File

@ -240,10 +240,9 @@ class IWLA(object):
# TODO : remove return
#return
with open(filename + '.tmp', 'wb+') as f:
with open(filename + '.tmp', 'wb+') as f, gzip.open(filename, 'w') as fzip:
pickle.dump(obj, f)
f.seek(0)
with gzip.open(filename, 'w') as fzip:
fzip.write(f.read())
os.remove(filename + '.tmp')
@ -485,8 +484,7 @@ class IWLA(object):
if not os.path.exists(gz_path) or\
os.stat(path).st_mtime > build_time:
with open(path, 'rb') as f_in:
with 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())
def _compressFiles(self, build_time, root):