diff --git a/iwla.py b/iwla.py index c41f06b..0f49362 100755 --- a/iwla.py +++ b/iwla.py @@ -194,7 +194,7 @@ class IWLA(object): return self.display def getDBFilename(self, time): - return os.path.join(conf.DB_ROOT, str(time.tm_year), str(time.tm_mon), conf.DB_FILENAME) + return os.path.join(conf.DB_ROOT, str(time.tm_year), '%02d' % time.tm_mon, conf.DB_FILENAME) def _serialize(self, obj, filename): base = os.path.dirname(filename) @@ -514,7 +514,6 @@ class IWLA(object): os.remove(path) print "==> Serialize to %s" % path - self._serialize(self.current_analysis, path) # Save month stats @@ -568,11 +567,10 @@ class IWLA(object): self.current_analysis = self._deserialize(self.getDBFilename(t)) or self._clearVisits() self.analyse_started = True else: + if time.mktime(t) < time.mktime(cur_time): + return False if not self.analyse_started: - if time.mktime(t) < time.mktime(cur_time): - return False - else: - self.analyse_started = True + self.analyse_started = True if cur_time.tm_mon != t.tm_mon: self._generateMonthStats() self.current_analysis = self._deserialize(self.getDBFilename(t)) or self._clearVisits()