diff --git a/TODO b/TODO index c3e15d5..4999056 100644 --- a/TODO +++ b/TODO @@ -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 diff --git a/default_conf.py b/default_conf.py index 3c42a1e..dcc8190 100644 --- a/default_conf.py +++ b/default_conf.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import os # Default configuration diff --git a/iwla.py b/iwla.py index 9eade1c..0c0f331 100755 --- a/iwla.py +++ b/iwla.py @@ -240,11 +240,10 @@ 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()) + fzip.write(f.read()) os.remove(filename + '.tmp') def _deserialize(self, filename): @@ -485,9 +484,8 @@ 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: - f_out.write(f_in.read()) + 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): if not conf.compress_output_files: return