# HG changeset patch # User Dirkjan Ochtman # Date 1240825050 -7200 # Node ID 25266fe996b0ad18d2efdab62ad45f4dbcd6c5e4 # Parent 227707c90548829a71b8b3d2abfc4a98215c1ab6 hgweb: use new sessionvars code in hgwebdir, too diff -r 227707c90548 -r 25266fe996b0 mercurial/hgweb/hgwebdir_mod.py --- 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