diff --git a/iwla.py b/iwla.py index c467687..2f01132 100755 --- a/iwla.py +++ b/iwla.py @@ -84,9 +84,9 @@ class IWLA(object): def hasBeenViewed(self, request): return int(request['status']) in conf.viewed_http_codes - def getCurDisplayRoot(self): + def getCurDisplayPath(self, filename): cur_time = self.meta_infos['last_time'] - return '%d/%d/' % (cur_time.tm_year, cur_time.tm_mon) + return os.path.join(str(cur_time.tm_year), str(cur_time.tm_mon), filename) def _clearMeta(self): self.meta_infos = { @@ -99,7 +99,7 @@ class IWLA(object): return self.display def getDBFilename(self, time): - return (conf.DB_ROOT + '%d/%d/%s') % (time.tm_year, time.tm_mon, conf.DB_FILENAME) + return os.path.join(conf.DB_ROOT, str(time.tm_year), str(time.tm_mon), conf.DB_FILENAME) def _serialize(self, obj, filename): base = os.path.dirname(filename) @@ -220,14 +220,14 @@ class IWLA(object): def getDisplayIndex(self): cur_time = self.meta_infos['last_time'] - filename = '%s/index.html' % (self.getCurDisplayRoot()) + filename = self.getCurDisplayPath('index.html') return self.display.getPage(filename) def _generateDisplayDaysStat(self): cur_time = self.meta_infos['last_time'] title = 'Stats %d/%d' % (cur_time.tm_mon, cur_time.tm_year) - filename = '%s/index.html' % (self.getCurDisplayRoot()) + filename = self.getCurDisplayPath('index.html') print '==> Generate display (%s)' % (filename) page = DisplayHTMLPage(title, filename) diff --git a/plugins/display/all_visits.py b/plugins/display/all_visits.py index ae9ed40..13e160b 100644 --- a/plugins/display/all_visits.py +++ b/plugins/display/all_visits.py @@ -18,7 +18,7 @@ class IWLADisplayAllVisits(IPlugin): title = time.strftime('All visits - %B %Y', self.iwla.getCurTime()) filename = 'all_visits.html' - path = '%s/%s' % (self.iwla.getCurDisplayRoot(), filename) + path = self.iwla.getCurDisplayPath(filename) page = DisplayHTMLPage(title, path) table = DisplayHTMLBlockTable('Last seen', ['Host', 'Pages', 'Hits', 'Bandwidth', 'Last seen']) diff --git a/plugins/display/referers.py b/plugins/display/referers.py index 329f998..06a87c0 100644 --- a/plugins/display/referers.py +++ b/plugins/display/referers.py @@ -55,7 +55,7 @@ class IWLADisplayReferers(IPlugin): title = time.strftime('Connexion from - %B %Y', cur_time) filename = 'referers.html' - path = '%s/%s' % (self.iwla.getCurDisplayRoot(), filename) + path = self.iwla.getCurDisplayPath(filename) page = DisplayHTMLPage(title, path) table = DisplayHTMLBlockTable('Connexion from', ['Origin', 'Pages', 'Hits']) @@ -94,7 +94,7 @@ class IWLADisplayReferers(IPlugin): title = time.strftime('Key Phrases - %B %Y', cur_time) filename = 'key_phrases.html' - path = '%s/%s' % (self.iwla.getCurDisplayRoot(), filename) + path = self.iwla.getCurDisplayPath(filename) page = DisplayHTMLPage(title, path) table = DisplayHTMLBlockTable('Top key phrases', ['Key phrase', 'Search']) diff --git a/plugins/display/top_downloads.py b/plugins/display/top_downloads.py index 44141a9..efe92d3 100644 --- a/plugins/display/top_downloads.py +++ b/plugins/display/top_downloads.py @@ -25,7 +25,7 @@ class IWLADisplayTopDownloads(IPlugin): title = time.strftime('Top Downloads - %B %Y', self.iwla.getCurTime()) filename = 'top_downloads.html' - path = '%s/%s' % (self.iwla.getCurDisplayRoot(), filename) + path = self.iwla.getCurDisplayPath(filename) page = DisplayHTMLPage(title, path) table = DisplayHTMLBlockTable('All Downloads', ['URI', 'Hit']) diff --git a/plugins/display/top_hits.py b/plugins/display/top_hits.py index fb7fe47..e196de9 100644 --- a/plugins/display/top_hits.py +++ b/plugins/display/top_hits.py @@ -25,7 +25,7 @@ class IWLADisplayTopHits(IPlugin): title = time.strftime('All Hits - %B %Y', self.iwla.getCurTime()) filename = 'top_hits.html' - path = '%s/%s' % (self.iwla.getCurDisplayRoot(), filename) + path = self.iwla.getCurDisplayPath(filename) page = DisplayHTMLPage(title, path) table = DisplayHTMLBlockTable('Top Hits', ['URI', 'Entrance']) diff --git a/plugins/display/top_pages.py b/plugins/display/top_pages.py index e2e29c0..ddd68b9 100644 --- a/plugins/display/top_pages.py +++ b/plugins/display/top_pages.py @@ -25,7 +25,7 @@ class IWLADisplayTopPages(IPlugin): title = time.strftime('All Pages - %B %Y', self.iwla.getCurTime()) filename = 'top_pages.html' - path = '%s/%s' % (self.iwla.getCurDisplayRoot(), filename) + path = self.iwla.getCurDisplayPath(filename) page = DisplayHTMLPage(title, path) table = DisplayHTMLBlockTable('Top Pages', ['URI', 'Entrance'])