diff mercurial/hgweb/hgwebdir_mod.py @ 3365:cf680c9ab1dd

Keep session variables when linking from hgwebdir's index to repositories.
author Thomas Arendsen Hein <thomas@intevation.de>
date Thu, 12 Oct 2006 17:06:51 +0200
parents 415905fad4fe
children ec6f400cff4d
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -90,6 +90,18 @@ class hgwebdir(object):
                            "node": nodeid, "url": url}
 
         def entries(sortcolumn="", descending=False, **map):
+            def sessionvars(**map):
+                fields = []
+                if req.form.has_key('style'):
+                    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 = 0
             for name, path in self.repos:
@@ -123,6 +135,7 @@ class hgwebdir(object):
                            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):