113 |
113 |
114 # POST? |
114 # POST? |
115 if request.is_post() : |
115 if request.is_post() : |
116 # update any modified preferences |
116 # update any modified preferences |
117 for pref in preferences.pref_list : |
117 for pref in preferences.pref_list : |
118 # get+parse new POST'd value |
118 # get the POST'd value, default = None |
119 # XXX: this doesn't postprocess |
119 post_value = request.get_post(pref.name, None) |
120 new_value = pref.parse(request.get_post(pref.name)) |
120 |
121 |
121 # skip non-specified values |
122 # update if changed |
122 # XXX: this is to not clobber timezone_offset to None |
|
123 if post_value is None : |
|
124 continue |
|
125 |
|
126 # parse the POST'd value, None -> default |
|
127 new_value = request.prefs.parse(pref, post_value) |
|
128 |
|
129 # update if given and changed |
123 if new_value != request.prefs[pref] : |
130 if new_value != request.prefs[pref] : |
124 request.prefs.set(pref.name, new_value) |
131 request.prefs.set(pref.name, new_value) |
125 |
132 |
126 # render |
133 # render |
127 return templates.render_to_response("preferences", |
134 return templates.render_to_response("preferences", |
128 req = request, |
135 req = request, |
129 prefs = request.prefs, |
136 prefs = request.prefs, |
130 preferences = prefs, |
137 preferences = prefs, |
131 timezones = pytz.common_timezones, |
|
132 ) |
138 ) |
133 |
139 |
134 def channel_select (request, channel) : |
140 def channel_select (request, channel) : |
135 """ |
141 """ |
136 Redirect to the appropriate channel_view |
142 Redirect to the appropriate channel_view |