comparison 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
comparison
equal deleted inserted replaced
2534:d5a3cc6520d5 2535:b8ccf6386db7
648 p = util.normpath(path) 648 p = util.normpath(path)
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, req): 653 def run(self):
654 if os.environ['GATEWAY_INTERFACE'][0:6] != "CGI/1.":
655 raise RuntimeError("This function is only intended to be called while running as a CGI script.")
656 import mercurial.hgweb.wsgicgi as wsgicgi
657 from request import wsgiapplication
658 def make_web_app():
659 return self.__class__(self.repo, self.reponame)
660 wsgicgi.launch(wsgiapplication(make_web_app))
661
662 def run_wsgi(self, req):
654 def header(**map): 663 def header(**map):
655 header_file = cStringIO.StringIO(''.join(self.t("header", **map))) 664 header_file = cStringIO.StringIO(''.join(self.t("header", **map)))
656 msg = mimetools.Message(header_file, 0) 665 msg = mimetools.Message(header_file, 0)
657 req.header(msg.items()) 666 req.header(msg.items())
658 yield header_file.read() 667 yield header_file.read()