--- a/handlers.py Wed Feb 11 23:38:05 2009 +0200
+++ b/handlers.py Thu Feb 12 00:16:52 2009 +0200
@@ -61,6 +61,35 @@
else :
raise http.ResponseError("Unrecognized type: %r" % (type, ))
+def _render_date (request, channel, date, lines, type, count, page, max) :
+ """
+ Render the given LogLines as a http.Response for channel_date
+ """
+
+ # type?
+ if type :
+ # special type
+ return _render_type(request, channel, lines, type)
+
+ else :
+ # format HTML
+ lines = request.prefs['formatter'].format_html(lines)
+
+ # render
+ return templates.render_to_response("channel_date",
+ req = request,
+ prefs = request.prefs,
+ channel = channel,
+ date = date,
+ count = count,
+ page = page,
+ max = max,
+ lines = lines,
+
+ # for prev/next date
+ date_next = channel.source.get_next_date(date),
+ date_prev = channel.source.get_prev_date(date),
+ )
def index (request) :
"""
@@ -143,31 +172,9 @@
# get correct day's correct page of lines
page, max, lines = channel.source.get_date_paged(timestamp, count)
-
- # type?
- if type :
- # special type
- return _render_type(request, channel, lines, type)
- else :
- # format HTML
- lines = formatter.format_html(lines)
-
- # render
- return templates.render_to_response("channel_date",
- req = request,
- prefs = request.prefs,
- channel = channel,
- date = timestamp,
- page = page,
- count = count,
- max = max,
- lines = lines,
-
- # for prev/next date
- date_next = channel.source.get_next_date(timestamp),
- date_prev = channel.source.get_prev_date(timestamp),
- )
+ # render channel_date
+ return _render_date (request, channel, timestamp, lines, type, count, page, max)
@preferences.handler(prefs.timezone)
def channel_calendar (request, channel, year, month, timezone) :
@@ -193,14 +200,14 @@
month = target,
)
-@preferences.handler(prefs.formatter, prefs.timezone, prefs.count)
-def channel_date (request, channel, date, formatter, timezone, count, page=1, type=None) :
+@preferences.handler(prefs.count)
+def channel_date (request, channel, date, count, page=1, type=None) :
"""
Display all log data for the given date
"""
- # fix date timezone
- date = timezone.localize(date)
+# print
+# print "channel_date: date=%s" % date
# get that day's events, either paged or not
if page :
@@ -210,30 +217,8 @@
lines = channel.source.get_date(date)
max = None
- # type?
- if type :
- # special type
- return _render_type(request, channel, lines, type)
-
- else :
- # lines
- lines = formatter.format_html(lines)
-
- # render page
- return templates.render_to_response("channel_date",
- req = request,
- prefs = request.prefs,
- channel = channel,
- date = date,
- page = page,
- count = count,
- max = max,
- lines = lines,
-
- # for prev/next date
- date_next = channel.source.get_next_date(date),
- date_prev = channel.source.get_prev_date(date),
- )
+ # render channel_date
+ return _render_date (request, channel, date, lines, type, count, page, max)
@preferences.handler(prefs.formatter, prefs.count)
def channel_search (request, channel, formatter, count, q=None, page=1, max=1, type=None) :