From 588b3179d572b6a76fd7f4a5b121b9a9d6bc814a Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Sun, 11 Jan 2015 18:05:09 +0100 Subject: [PATCH] Generate display before serialization (avoid errors when generation raise exception and database partially saved (months but not meta)) --- iwla.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iwla.py b/iwla.py index 0bd6278..ca68ad0 100755 --- a/iwla.py +++ b/iwla.py @@ -578,6 +578,8 @@ class IWLA(object): if os.path.exists(path): os.remove(path) + self._generateDisplay() + self.logger.info("==> Serialize to %s" % (path)) self._serialize(self.current_analysis, path) @@ -590,7 +592,8 @@ class IWLA(object): self.meta_infos['stats'][year] = {} self.meta_infos['stats'][year][month] = duplicated_stats - self._generateDisplay() + self.logger.info("==> Serialize to %s" % (conf.META_PATH)) + self._serialize(self.meta_infos, conf.META_PATH) def _generateDayStats(self): visits = self.current_analysis['visits'] @@ -700,7 +703,6 @@ class IWLA(object): self._generateDayStats() self._generateMonthStats() del self.meta_infos['start_analysis_time'] - self._serialize(self.meta_infos, conf.META_PATH) else: self.logger.info('==> Analyse not started : nothing new')