mercurial/hgweb/hgweb_mod.py
changeset 2535 b8ccf6386db7
parent 2534 d5a3cc6520d5
child 2538 f4b7d71c1c60
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()