##// END OF EJS Templates
hgweb: use new sessionvars code in hgwebdir, too
Dirkjan Ochtman -
r8216:25266fe9 default
parent child Browse files
Show More
@@ -14,6 +14,7 b' from common import ErrorResponse, get_mt'
14 14 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
15 15 from hgweb_mod import hgweb
16 16 from request import wsgirequest
17 import webutil
17 18
18 19 def cleannames(items):
19 20 return [(util.pconvert(name).strip('/'), path) for name, path in items]
@@ -185,18 +186,6 b' class hgwebdir(object):'
185 186 "node": nodeid, "url": url}
186 187
187 188 def entries(sortcolumn="", descending=False, subdir="", **map):
188 def sessionvars(**map):
189 fields = []
190 if 'style' in req.form:
191 style = req.form['style'][0]
192 if style != get('web', 'style', ''):
193 fields.append(('style', style))
194
195 separator = url[-1] == '?' and ';' or '?'
196 for name, value in fields:
197 yield dict(name=name, value=value, separator=separator)
198 separator = ';'
199
200 189 rows = []
201 190 parity = paritygen(self.stripecount)
202 191 for name, path in self.repos:
@@ -244,7 +233,6 b' class hgwebdir(object):'
244 233 description_sort=description.upper() or "unknown",
245 234 lastchange=d,
246 235 lastchange_sort=d[1]-d[0],
247 sessionvars=sessionvars,
248 236 archives=archivelist(u, "tip", url))
249 237 if (not sortcolumn
250 238 or (sortcolumn, descending) == self.repos_sorted):
@@ -307,6 +295,13 b' class hgwebdir(object):'
307 295 if not url.endswith('/'):
308 296 url += '/'
309 297
298 vars = {}
299 style = self.style
300 if 'style' in req.form:
301 vars['style'] = style = req.form['style'][0]
302 start = url[-1] == '?' and '&' or '?'
303 sessionvars = webutil.sessionvars(vars, start)
304
310 305 staticurl = config('web', 'staticurl') or url + 'static/'
311 306 if not staticurl.endswith('/'):
312 307 staticurl += '/'
@@ -318,5 +313,6 b' class hgwebdir(object):'
318 313 "footer": footer,
319 314 "motd": motd,
320 315 "url": url,
321 "staticurl": staticurl})
316 "staticurl": staticurl,
317 "sessionvars": sessionvars})
322 318 return tmpl
General Comments 0
You need to be logged in to leave comments. Login now