equal
deleted
inserted
replaced
1 """ |
1 """ |
2 Our URL action handlers |
2 Our URL action handlers |
3 """ |
3 """ |
|
4 |
|
5 import pytz |
4 |
6 |
5 from qmsk.web import http, template |
7 from qmsk.web import http, template |
6 |
8 |
7 import urls, channels, helpers |
9 import urls, channels, helpers |
8 |
10 |
35 """ |
37 """ |
36 |
38 |
37 # get latest events |
39 # get latest events |
38 lines = channel.source.get_latest(count) |
40 lines = channel.source.get_latest(count) |
39 |
41 |
40 # format |
42 # formatter |
|
43 formatter = formatter(pytz.utc, '%H:%M:%S') |
|
44 |
|
45 # lines |
41 lines = formatter.format_html(lines) |
46 lines = formatter.format_html(lines) |
42 |
47 |
43 return templates.render_to_response("channel_view", |
48 return templates.render_to_response("channel_view", |
44 req = request, |
49 req = request, |
45 channel = channel, |
50 channel = channel, |
59 pass |
64 pass |
60 |
65 |
61 else : |
66 else : |
62 raise http.ResponseError("Unknown filetype %r" % format) |
67 raise http.ResponseError("Unknown filetype %r" % format) |
63 |
68 |
|
69 def channel_calendar (request, channel) : |
|
70 """ |
|
71 Display a list of avilable logs for some days |
|
72 """ |
|
73 |
|
74 pass |
|
75 |
64 def channel_date (request, channel, date, formatter) : |
76 def channel_date (request, channel, date, formatter) : |
65 """ |
77 """ |
66 Display all log data for the given date |
78 Display all log data for the given date |
67 """ |
79 """ |
68 |
80 |
69 # XXX: fix date timezone |
81 # XXX: fix date timezone |
70 import pytz |
|
71 date = date.replace(tzinfo=pytz.utc) |
82 date = date.replace(tzinfo=pytz.utc) |
72 |
83 |
73 # get latest events |
84 # get latest events |
74 lines = channel.source.get_date(date) |
85 lines = channel.source.get_date(date) |
75 |
86 |
76 # format |
87 # formatter |
|
88 formatter = formatter(pytz.utc, '%H:%M:%S') |
|
89 |
|
90 # lines |
77 lines = formatter.format_html(lines) |
91 lines = formatter.format_html(lines) |
78 |
92 |
79 return templates.render_to_response("channel_date", |
93 return templates.render_to_response("channel_date", |
80 req = request, |
94 req = request, |
81 channel = channel, |
95 channel = channel, |