Mercurial > public > mercurial-scm > hg
diff mercurial/hgweb/hgweb_mod.py @ 2535:b8ccf6386db7
Arrange for old copies of CGI scripts to still work.
author | Eric Hopper <hopper@omnifarious.org> |
---|---|
date | Thu, 29 Jun 2006 19:06:18 -0700 |
parents | d5a3cc6520d5 |
children | f4b7d71c1c60 |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Thu Jun 29 18:34:26 2006 -0700 +++ b/mercurial/hgweb/hgweb_mod.py Thu Jun 29 19:06:18 2006 -0700 @@ -650,7 +650,16 @@ raise Exception("suspicious path") return p - def run(self, req): + def run(self): + if os.environ['GATEWAY_INTERFACE'][0:6] != "CGI/1.": + raise RuntimeError("This function is only intended to be called while running as a CGI script.") + import mercurial.hgweb.wsgicgi as wsgicgi + from request import wsgiapplication + def make_web_app(): + return self.__class__(self.repo, self.reponame) + wsgicgi.launch(wsgiapplication(make_web_app)) + + def run_wsgi(self, req): def header(**map): header_file = cStringIO.StringIO(''.join(self.t("header", **map))) msg = mimetools.Message(header_file, 0)