# HG changeset patch # User Matt Mackall # Date 2009-06-20 18:00:25 # Node ID 580a79dde2a364509cd7b9570d2eb8351253ed95 # Parent 16f6c13706df6068140411598f7072bf68eb81ec hgweb: web.encoding should override encoding.encoding (issue1183) diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -64,7 +64,8 @@ class hgweb(object): 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 @@ class hgweb(object): 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 @@ class hgweb(object): # 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) diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -70,6 +70,8 @@ class hgwebdir(object): 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)