Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgwebdir_mod.py @ 7948:de377b1a9a84
move encoding bits from util to encoding
In addition to cleaning up util, this gets rid of some circular dependencies.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 03 Apr 2009 14:51:48 -0500 |
parents | 176d3d681702 |
children | aa983c3d94a9 |
comparison
equal
deleted
inserted
replaced
7947:a454eeb1b827 | 7948:de377b1a9a84 |
---|---|
6 # This software may be used and distributed according to the terms | 6 # This software may be used and distributed according to the terms |
7 # of the GNU General Public License, incorporated herein by reference. | 7 # of the GNU General Public License, incorporated herein by reference. |
8 | 8 |
9 import os | 9 import os |
10 from mercurial.i18n import _ | 10 from mercurial.i18n import _ |
11 from mercurial import ui, hg, util, templater, templatefilters, error | 11 from mercurial import ui, hg, util, templater, templatefilters, error, encoding |
12 from common import ErrorResponse, get_mtime, staticfile, style_map, paritygen,\ | 12 from common import ErrorResponse, get_mtime, staticfile, style_map, paritygen,\ |
13 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR | 13 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
14 from hgweb_mod import hgweb | 14 from hgweb_mod import hgweb |
15 from request import wsgirequest | 15 from request import wsgirequest |
16 | 16 |
117 try: | 117 try: |
118 try: | 118 try: |
119 | 119 |
120 virtual = req.env.get("PATH_INFO", "").strip('/') | 120 virtual = req.env.get("PATH_INFO", "").strip('/') |
121 tmpl = self.templater(req) | 121 tmpl = self.templater(req) |
122 ctype = tmpl('mimetype', encoding=util._encoding) | 122 ctype = tmpl('mimetype', encoding=encoding.encoding) |
123 ctype = templater.stringify(ctype) | 123 ctype = templater.stringify(ctype) |
124 | 124 |
125 # a static file | 125 # a static file |
126 if virtual.startswith('static/') or 'static' in req.form: | 126 if virtual.startswith('static/') or 'static' in req.form: |
127 if virtual.startswith('static/'): | 127 if virtual.startswith('static/'): |
283 **dict(sort)) | 283 **dict(sort)) |
284 | 284 |
285 def templater(self, req): | 285 def templater(self, req): |
286 | 286 |
287 def header(**map): | 287 def header(**map): |
288 yield tmpl('header', encoding=util._encoding, **map) | 288 yield tmpl('header', encoding=encoding.encoding, **map) |
289 | 289 |
290 def footer(**map): | 290 def footer(**map): |
291 yield tmpl("footer", **map) | 291 yield tmpl("footer", **map) |
292 | 292 |
293 def motd(**map): | 293 def motd(**map): |