5 # |
5 # |
6 # This software may be used and distributed according to the terms of the |
6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2, incorporated herein by reference. |
7 # GNU General Public License version 2, incorporated herein by reference. |
8 |
8 |
9 import os |
9 import os |
10 from mercurial import ui, hg, util, hook, error, encoding |
10 from mercurial import ui, hg, util, hook, error, encoding, templater |
11 from mercurial import templater, templatefilters |
|
12 from common import get_mtime, ErrorResponse |
11 from common import get_mtime, ErrorResponse |
13 from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
12 from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
14 from common import HTTP_UNAUTHORIZED, HTTP_METHOD_NOT_ALLOWED |
13 from common import HTTP_UNAUTHORIZED, HTTP_METHOD_NOT_ALLOWED |
15 from request import wsgirequest |
14 from request import wsgirequest |
16 import webcommands, protocol, webutil |
15 import webcommands, protocol, webutil |
244 or req.env.get('REPO_NAME') |
243 or req.env.get('REPO_NAME') |
245 or req.url.strip('/') or self.repo.root) |
244 or req.url.strip('/') or self.repo.root) |
246 |
245 |
247 # create the templater |
246 # create the templater |
248 |
247 |
249 tmpl = templater.templater(mapfile, templatefilters.filters, |
248 tmpl = templater.templater(mapfile, |
250 defaults={"url": req.url, |
249 defaults={"url": req.url, |
251 "staticurl": staticurl, |
250 "staticurl": staticurl, |
252 "urlbase": urlbase, |
251 "urlbase": urlbase, |
253 "repo": self.reponame, |
252 "repo": self.reponame, |
254 "header": header, |
253 "header": header, |