Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/hgwebdir_mod.py @ 6391:a1007f7b9b7b
Backed out changeset d2bb66a8a435 (temporary template compatibility)
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 24 Mar 2008 18:18:39 +0100 |
parents | d2bb66a8a435 |
children | a63aed912e54 |
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py Thu Mar 27 12:52:41 2008 -0700 +++ b/mercurial/hgweb/hgwebdir_mod.py Mon Mar 24 18:18:39 2008 +0100 @@ -6,7 +6,7 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. -import os, mimetools, cStringIO +import os from mercurial.i18n import gettext as _ from mercurial.repo import RepoError from mercurial import ui, hg, util, templater, templatefilters @@ -81,17 +81,8 @@ virtual = req.env.get("PATH_INFO", "").strip('/') tmpl = self.templater(req) - try: - ctype = tmpl('mimetype', encoding=util._encoding) - ctype = templater.stringify(ctype) - except KeyError: - # old templates with inline HTTP headers? - if 'mimetype' in tmpl: - raise - header = tmpl('header', encoding=util._encoding) - header_file = cStringIO.StringIO(templater.stringify(header)) - msg = mimetools.Message(header_file, 0) - ctype = msg['content-type'] + ctype = tmpl('mimetype', encoding=util._encoding) + ctype = templater.stringify(ctype) # a static file if virtual.startswith('static/') or 'static' in req.form: @@ -255,13 +246,7 @@ def templater(self, req): def header(**map): - header = tmpl('header', encoding=util._encoding, **map) - if 'mimetype' not in tmpl: - # old template with inline HTTP headers - header_file = cStringIO.StringIO(templater.stringify(header)) - msg = mimetools.Message(header_file, 0) - header = header_file.read() - yield header + yield tmpl('header', encoding=util._encoding, **map) def footer(**map): yield tmpl("footer", **map)