24 |
24 |
25 return templates.render_to_response("index", |
25 return templates.render_to_response("index", |
26 req = request, |
26 req = request, |
27 ) |
27 ) |
28 |
28 |
|
29 # XXX: fix this namespace crap |
|
30 @preferences.handler() |
|
31 def preferences_ (request) : |
|
32 """ |
|
33 Preferences editor |
|
34 """ |
|
35 |
|
36 # POST? |
|
37 if request.is_post() : |
|
38 # update any modified preferences |
|
39 for pref in preferences.pref_list : |
|
40 # get+parse new POST'd value |
|
41 # XXX: this doesn't postprocess |
|
42 new_value = pref.parse(request.get_post(pref.name)) |
|
43 |
|
44 # update if changed |
|
45 if new_value != request.prefs[pref] : |
|
46 request.prefs.set(pref.name, new_value) |
|
47 |
|
48 # render |
|
49 return templates.render_to_response("preferences", |
|
50 req = request, |
|
51 prefs = request.prefs, |
|
52 preferences = prefs, |
|
53 timezone = request.prefs[prefs.timezone], |
|
54 timezones = pytz.common_timezones, |
|
55 ) |
|
56 |
29 def channel_select (request, channel) : |
57 def channel_select (request, channel) : |
30 """ |
58 """ |
31 Redirect to the appropriate channel_view |
59 Redirect to the appropriate channel_view |
32 """ |
60 """ |
33 |
61 |
34 return http.Redirect(urls.channel_view.build(request, channel=channel)) |
62 return http.Redirect(urls.channel_view.build(request, channel=channel)) |
35 |
63 |
36 @preferences.handler(prefs.Formatter, prefs.Timezone) |
64 @preferences.handler(prefs.formatter) |
37 def channel_view (request, channel, count, formatter, timezone) : |
65 def channel_view (request, channel, count, formatter) : |
38 """ |
66 """ |
39 The main channel view page, display the most important info, and all requisite links |
67 The main channel view page, display the most important info, and all requisite links |
40 """ |
68 """ |
41 |
69 |
42 # get latest events |
70 # get latest events |
68 pass |
96 pass |
69 |
97 |
70 else : |
98 else : |
71 raise http.ResponseError("Unknown filetype %r" % format) |
99 raise http.ResponseError("Unknown filetype %r" % format) |
72 |
100 |
73 @preferences.handler(prefs.Timezone) |
101 @preferences.handler(prefs.timezone) |
74 def channel_calendar (request, channel, year, month, timezone) : |
102 def channel_calendar (request, channel, year, month, timezone) : |
75 """ |
103 """ |
76 Display a list of avilable logs for some month |
104 Display a list of avilable logs for some month |
77 """ |
105 """ |
78 |
106 |
97 calendar = calendar.Calendar(), |
125 calendar = calendar.Calendar(), |
98 month = target.date(), |
126 month = target.date(), |
99 days = days, |
127 days = days, |
100 ) |
128 ) |
101 |
129 |
102 @preferences.handler(prefs.Formatter, prefs.Timezone) |
130 @preferences.handler(prefs.formatter, prefs.timezone) |
103 def channel_date (request, channel, date, formatter, timezone) : |
131 def channel_date (request, channel, date, formatter, timezone) : |
104 """ |
132 """ |
105 Display all log data for the given date |
133 Display all log data for the given date |
106 """ |
134 """ |
107 |
135 |