mercurial/hgweb/hgwebdir_mod.py
changeset 9842 d3dbdca92458
parent 9724 40ef3bf3e04a
child 9903 5d748045c2ae
--- a/mercurial/hgweb/hgwebdir_mod.py	Thu Nov 12 10:29:40 2009 -0500
+++ b/mercurial/hgweb/hgwebdir_mod.py	Thu Nov 12 16:39:11 2009 +0100
@@ -315,18 +315,21 @@
             url += '/'
 
         vars = {}
-        style = self.style
-        if 'style' in req.form:
-            vars['style'] = style = req.form['style'][0]
+        styles = (
+            req.form.get('style', [None])[0],
+            config('web', 'style'),
+            'paper'
+        )
+        style, mapfile = templater.stylemap(styles)
+        if style == styles[0]:
+            vars['style'] = style
+        
         start = url[-1] == '?' and '&' or '?'
         sessionvars = webutil.sessionvars(vars, start)
-
         staticurl = config('web', 'staticurl') or url + 'static/'
         if not staticurl.endswith('/'):
             staticurl += '/'
 
-        style = 'style' in req.form and req.form['style'][0] or self.style
-        mapfile = templater.stylemap(style)
         tmpl = templater.templater(mapfile,
                                    defaults={"header": header,
                                              "footer": footer,