Mercurial > hg-stable
changeset 8216:25266fe996b0
hgweb: use new sessionvars code in hgwebdir, too
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 27 Apr 2009 11:37:30 +0200 |
parents | 227707c90548 |
children | d895158fe8af |
files | mercurial/hgweb/hgwebdir_mod.py |
diffstat | 1 files changed, 10 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py Mon Apr 27 11:37:08 2009 +0200 +++ b/mercurial/hgweb/hgwebdir_mod.py Mon Apr 27 11:37:30 2009 +0200 @@ -14,6 +14,7 @@ get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR from hgweb_mod import hgweb from request import wsgirequest +import webutil def cleannames(items): return [(util.pconvert(name).strip('/'), path) for name, path in items] @@ -185,18 +186,6 @@ "node": nodeid, "url": url} def entries(sortcolumn="", descending=False, subdir="", **map): - def sessionvars(**map): - fields = [] - if 'style' in req.form: - style = req.form['style'][0] - if style != get('web', 'style', ''): - fields.append(('style', style)) - - separator = url[-1] == '?' and ';' or '?' - for name, value in fields: - yield dict(name=name, value=value, separator=separator) - separator = ';' - rows = [] parity = paritygen(self.stripecount) for name, path in self.repos: @@ -244,7 +233,6 @@ description_sort=description.upper() or "unknown", lastchange=d, lastchange_sort=d[1]-d[0], - sessionvars=sessionvars, archives=archivelist(u, "tip", url)) if (not sortcolumn or (sortcolumn, descending) == self.repos_sorted): @@ -307,6 +295,13 @@ if not url.endswith('/'): url += '/' + vars = {} + style = self.style + if 'style' in req.form: + vars['style'] = style = req.form['style'][0] + start = url[-1] == '?' and '&' or '?' + sessionvars = webutil.sessionvars(vars, start) + staticurl = config('web', 'staticurl') or url + 'static/' if not staticurl.endswith('/'): staticurl += '/' @@ -318,5 +313,6 @@ "footer": footer, "motd": motd, "url": url, - "staticurl": staticurl}) + "staticurl": staticurl, + "sessionvars": sessionvars}) return tmpl