hgweb: web.encoding should override encoding.encoding (issue1183)
authorMatt Mackall <mpm@selenic.com>
Sat, 20 Jun 2009 13:00:25 -0500
changeset 8859 580a79dde2a3
parent 8858 16f6c13706df
child 8860 36654238c050
hgweb: web.encoding should override encoding.encoding (issue1183)
mercurial/hgweb/hgweb_mod.py
mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Sat Jun 20 11:50:51 2009 -0500
+++ b/mercurial/hgweb/hgweb_mod.py	Sat Jun 20 13:00:25 2009 -0500
@@ -64,7 +64,8 @@
             self.maxshortchanges = int(self.config("web", "maxshortchanges", 60))
             self.maxfiles = int(self.config("web", "maxfiles", 10))
             self.allowpull = self.configbool("web", "allowpull", True)
-            self.encoding = self.config("web", "encoding", encoding.encoding)
+            encoding.encoding = self.config("web", "encoding",
+                                            encoding.encoding)
 
     def run(self):
         if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
@@ -160,7 +161,7 @@
 
         try:
             tmpl = self.templater(req)
-            ctype = tmpl('mimetype', encoding=self.encoding)
+            ctype = tmpl('mimetype', encoding=encoding.encoding)
             ctype = templater.stringify(ctype)
 
             # check read permissions non-static content
@@ -219,7 +220,7 @@
         # some functions for the templater
 
         def header(**map):
-            yield tmpl('header', encoding=self.encoding, **map)
+            yield tmpl('header', encoding=encoding.encoding, **map)
 
         def footer(**map):
             yield tmpl("footer", **map)
--- a/mercurial/hgweb/hgwebdir_mod.py	Sat Jun 20 11:50:51 2009 -0500
+++ b/mercurial/hgweb/hgwebdir_mod.py	Sat Jun 20 13:00:25 2009 -0500
@@ -70,6 +70,8 @@
         elif isinstance(self.conf, dict):
             paths = self.conf.items()
 
+        encoding.encoding = self.ui.config('web', 'encoding',
+                                           encoding.encoding)
         self.motd = self.ui.config('web', 'motd')
         self.style = self.ui.config('web', 'style', 'paper')
         self.stripecount = self.ui.config('web', 'stripes', 1)