mercurial/hgweb/hgwebdir_mod.py
changeset 27045 eac72c1e1e0d
parent 27043 ccdc95c6841e
child 27046 37fcfe52c68c
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)