contrib/win32/hgwebdir_wsgi.py
changeset 51690 493034cc3265
parent 48875 6000f5b25c9b
child 51700 7f0cb9ee0534
equal deleted inserted replaced
51689:39e2b2d062c1 51690:493034cc3265
    99     win32traceutil.SetupForPrint  # silence unused import warning
    99     win32traceutil.SetupForPrint  # silence unused import warning
   100 
   100 
   101 import isapi_wsgi
   101 import isapi_wsgi
   102 from mercurial.hgweb.hgwebdir_mod import hgwebdir
   102 from mercurial.hgweb.hgwebdir_mod import hgwebdir
   103 
   103 
       
   104 
   104 # Example tweak: Replace isapi_wsgi's handler to provide better error message
   105 # Example tweak: Replace isapi_wsgi's handler to provide better error message
   105 # Other stuff could also be done here, like logging errors etc.
   106 # Other stuff could also be done here, like logging errors etc.
   106 class WsgiHandler(isapi_wsgi.IsapiWsgiHandler):
   107 class WsgiHandler(isapi_wsgi.IsapiWsgiHandler):
   107     error_status = '500 Internal Server Error'  # less silly error message
   108     error_status = '500 Internal Server Error'  # less silly error message
   108 
   109 
   112 # Only create the hgwebdir instance once
   113 # Only create the hgwebdir instance once
   113 application = hgwebdir(hgweb_config)
   114 application = hgwebdir(hgweb_config)
   114 
   115 
   115 
   116 
   116 def handler(environ, start_response):
   117 def handler(environ, start_response):
   117 
       
   118     # Translate IIS's weird URLs
   118     # Translate IIS's weird URLs
   119     url = environ['SCRIPT_NAME'] + environ['PATH_INFO']
   119     url = environ['SCRIPT_NAME'] + environ['PATH_INFO']
   120     paths = url[1:].split('/')[path_strip:]
   120     paths = url[1:].split('/')[path_strip:]
   121     script_name = '/' + '/'.join(paths[:path_prefix])
   121     script_name = '/' + '/'.join(paths[:path_prefix])
   122     path_info = '/'.join(paths[path_prefix:])
   122     path_info = '/'.join(paths[path_prefix:])