Mercurial > hg
diff mercurial/hgweb/hgweb_mod.py @ 5928:3340aa5a64f7
hgweb: move HTTP content types out of header templates
This removes the ability for templates to add custom HTTP headers, which can
easily be re-added if someone needs it. Thanks to asak for repeatedly reviewing
this patch and helping to iron out the quirks.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Tue, 22 Jan 2008 10:45:55 +0100 |
parents | f39110afc039 |
children | c301f15c965a |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Tue Jan 22 10:45:52 2008 +0100 +++ b/mercurial/hgweb/hgweb_mod.py Tue Jan 22 10:45:55 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, mimetypes, re, mimetools, cStringIO +import os, mimetypes, re from mercurial.node import * from mercurial import mdiff, ui, hg, util, archival, patch, hook from mercurial import revlog, templater @@ -253,11 +253,9 @@ # some functions for the templater def header(**map): - header_file = cStringIO.StringIO( - ''.join(tmpl("header", encoding=self.encoding, **map))) - msg = mimetools.Message(header_file, 0) - req.header(msg.items()) - yield header_file.read() + ctype = tmpl('mimetype', encoding=self.encoding) + req.httphdr(templater.stringify(ctype)) + yield tmpl('header', encoding=self.encoding, **map) def footer(**map): yield tmpl("footer", **map)