--- a/handlers.py Mon Feb 09 01:17:32 2009 +0200
+++ b/handlers.py Mon Feb 09 03:05:43 2009 +0200
@@ -7,6 +7,8 @@
from qmsk.web import http, template
import urls, channels, helpers
+import preferences as prefs
+from preferences import preferences
# load templates from here
templates = template.TemplateLoader("templates",
@@ -31,6 +33,7 @@
return http.Redirect(urls.channel_view.build(request, channel=channel.id))
+@preferences.handler(prefs.Formatter)
def channel_view (request, channel, count, formatter) :
"""
The main channel view page, display the most important info, and all requisite links
@@ -39,9 +42,6 @@
# get latest events
lines = channel.source.get_latest(count)
- # formatter
- formatter = formatter(pytz.utc, '%H:%M:%S')
-
# lines
lines = formatter.format_html(lines)
@@ -73,20 +73,18 @@
pass
-def channel_date (request, channel, date, formatter) :
+@preferences.handler(prefs.Formatter, prefs.Timezone)
+def channel_date (request, channel, date, formatter, timezone) :
"""
Display all log data for the given date
"""
- # XXX: fix date timezone
- date = date.replace(tzinfo=pytz.utc)
+ # fix date timezone
+ date = date.replace(tzinfo=timezone)
# get latest events
lines = channel.source.get_date(date)
- # formatter
- formatter = formatter(pytz.utc, '%H:%M:%S')
-
# lines
lines = formatter.format_html(lines)