##// 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 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
14 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
15 from hgweb_mod import hgweb
15 from hgweb_mod import hgweb
16 from request import wsgirequest
16 from request import wsgirequest
17 import webutil
17
18
18 def cleannames(items):
19 def cleannames(items):
19 return [(util.pconvert(name).strip('/'), path) for name, path in items]
20 return [(util.pconvert(name).strip('/'), path) for name, path in items]
@@ -185,18 +186,6 b' class hgwebdir(object):'
185 "node": nodeid, "url": url}
186 "node": nodeid, "url": url}
186
187
187 def entries(sortcolumn="", descending=False, subdir="", **map):
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 rows = []
189 rows = []
201 parity = paritygen(self.stripecount)
190 parity = paritygen(self.stripecount)
202 for name, path in self.repos:
191 for name, path in self.repos:
@@ -244,7 +233,6 b' class hgwebdir(object):'
244 description_sort=description.upper() or "unknown",
233 description_sort=description.upper() or "unknown",
245 lastchange=d,
234 lastchange=d,
246 lastchange_sort=d[1]-d[0],
235 lastchange_sort=d[1]-d[0],
247 sessionvars=sessionvars,
248 archives=archivelist(u, "tip", url))
236 archives=archivelist(u, "tip", url))
249 if (not sortcolumn
237 if (not sortcolumn
250 or (sortcolumn, descending) == self.repos_sorted):
238 or (sortcolumn, descending) == self.repos_sorted):
@@ -307,6 +295,13 b' class hgwebdir(object):'
307 if not url.endswith('/'):
295 if not url.endswith('/'):
308 url += '/'
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 staticurl = config('web', 'staticurl') or url + 'static/'
305 staticurl = config('web', 'staticurl') or url + 'static/'
311 if not staticurl.endswith('/'):
306 if not staticurl.endswith('/'):
312 staticurl += '/'
307 staticurl += '/'
@@ -318,5 +313,6 b' class hgwebdir(object):'
318 "footer": footer,
313 "footer": footer,
319 "motd": motd,
314 "motd": motd,
320 "url": url,
315 "url": url,
321 "staticurl": staticurl})
316 "staticurl": staticurl,
317 "sessionvars": sessionvars})
322 return tmpl
318 return tmpl
General Comments 0
You need to be logged in to leave comments. Login now