Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgwebdir_mod.py @ 27045:eac72c1e1e0d
hgweb: import wsgicgi at top level
There should be no practical reason to delay the import of wsgicgi.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 01 Nov 2015 15:09:35 +0900 |
parents | ccdc95c6841e |
children | 37fcfe52c68c |
comparison
equal
deleted
inserted
replaced
27044:1dde4914fb6c | 27045:eac72c1e1e0d |
---|---|
13 from mercurial import error, encoding | 13 from mercurial import error, encoding |
14 from common import ErrorResponse, get_mtime, staticfile, paritygen, ismember, \ | 14 from common import ErrorResponse, get_mtime, staticfile, paritygen, ismember, \ |
15 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR | 15 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
16 import hgweb_mod | 16 import hgweb_mod |
17 from request import wsgirequest | 17 from request import wsgirequest |
18 import webutil | 18 import webutil, wsgicgi |
19 | 19 |
20 def cleannames(items): | 20 def cleannames(items): |
21 return [(util.pconvert(name).strip('/'), path) for name, path in items] | 21 return [(util.pconvert(name).strip('/'), path) for name, path in items] |
22 | 22 |
23 def findrepos(paths): | 23 def findrepos(paths): |
160 | 160 |
161 def run(self): | 161 def run(self): |
162 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): | 162 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): |
163 raise RuntimeError("This function is only intended to be " | 163 raise RuntimeError("This function is only intended to be " |
164 "called while running as a CGI script.") | 164 "called while running as a CGI script.") |
165 import mercurial.hgweb.wsgicgi as wsgicgi | |
166 wsgicgi.launch(self) | 165 wsgicgi.launch(self) |
167 | 166 |
168 def __call__(self, env, respond): | 167 def __call__(self, env, respond): |
169 req = wsgirequest(env, respond) | 168 req = wsgirequest(env, respond) |
170 return self.run_wsgi(req) | 169 return self.run_wsgi(req) |