From f3f68150222adae4af18e03188606cf4d217cc45 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 26 Nov 2010 17:58:23 +0100 Subject: [PATCH] WebStats: prepare /channels/NAME/subdir style url --- WebStats/plugin.py | 16 +++++++++++++--- WebStats/templates/chan_index.py | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/WebStats/plugin.py b/WebStats/plugin.py index 7d76bd5..2e68fda 100644 --- a/WebStats/plugin.py +++ b/WebStats/plugin.py @@ -102,9 +102,19 @@ class HTTPHandler(BaseHTTPServer.BaseHTTPRequestHandler): elif self.path.startswith('/%s/' % _('channels')): response = 200 content_type = 'text/html' - chanName = self.path.split('/')[2] - output = getTemplate('chan_index').get(not testing, chanName, - self.server.db) + splittedPath = self.path.split('/') + chanName = splittedPath[2] + print splittedPath + if len(splittedPath) == 3: + output = getTemplate('chan_index').get(not testing, + chanName, + self.server.db) + else: + subdir = splittedPath[3] + output = getTemplate('chan_index').get(not testing, + chanName, + self.server.db, + subdir) else: response = 404 content_type = 'text/html' diff --git a/WebStats/templates/chan_index.py b/WebStats/templates/chan_index.py index 912d599..d725dcc 100644 --- a/WebStats/templates/chan_index.py +++ b/WebStats/templates/chan_index.py @@ -48,7 +48,7 @@ headers = (_('Hour'), _('Lines'), _('Words'), _('Joins'), _('Parts'), tableHeaders = '' for header in headers: tableHeaders += '' % header -def get(useSkeleton, channel, db): +def get(useSkeleton, channel, db, orderby=None): channel = '#' + channel items = db.getChanGlobalData(channel) bound = db.getChanRecordingTimeBoundaries(channel)
%s