Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgweb_mod.py @ 2538:f4b7d71c1c60
Cleanup hgweb and hgwebdir's run method a bit.
author | Eric Hopper <hopper@omnifarious.org> |
---|---|
date | Fri, 30 Jun 2006 09:50:25 -0700 |
parents | b8ccf6386db7 |
children | 1120302009d7 |
comparison
equal
deleted
inserted
replaced
2537:b6975008d44f | 2538:f4b7d71c1c60 |
---|---|
649 if p[:2] == "..": | 649 if p[:2] == "..": |
650 raise Exception("suspicious path") | 650 raise Exception("suspicious path") |
651 return p | 651 return p |
652 | 652 |
653 def run(self): | 653 def run(self): |
654 if os.environ['GATEWAY_INTERFACE'][0:6] != "CGI/1.": | 654 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): |
655 raise RuntimeError("This function is only intended to be called while running as a CGI script.") | 655 raise RuntimeError("This function is only intended to be called while running as a CGI script.") |
656 import mercurial.hgweb.wsgicgi as wsgicgi | 656 import mercurial.hgweb.wsgicgi as wsgicgi |
657 from request import wsgiapplication | 657 from request import wsgiapplication |
658 def make_web_app(): | 658 def make_web_app(): |
659 return self.__class__(self.repo, self.reponame) | 659 return self |
660 wsgicgi.launch(wsgiapplication(make_web_app)) | 660 wsgicgi.launch(wsgiapplication(make_web_app)) |
661 | 661 |
662 def run_wsgi(self, req): | 662 def run_wsgi(self, req): |
663 def header(**map): | 663 def header(**map): |
664 header_file = cStringIO.StringIO(''.join(self.t("header", **map))) | 664 header_file = cStringIO.StringIO(''.join(self.t("header", **map))) |