Mercurial > public > mercurial-scm > hg-stable
diff contrib/win32/hgwebdir_wsgi.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | d22198b4b3dd |
children | 6000f5b25c9b |
line wrap: on
line diff
--- a/contrib/win32/hgwebdir_wsgi.py Sat Oct 05 10:29:34 2019 -0400 +++ b/contrib/win32/hgwebdir_wsgi.py Sun Oct 06 09:45:02 2019 -0400 @@ -84,19 +84,20 @@ hgweb_config = r'c:\your\directory\wsgi.config' # Global settings for IIS path translation -path_strip = 0 # Strip this many path elements off (when using url rewrite) +path_strip = 0 # Strip this many path elements off (when using url rewrite) path_prefix = 1 # This many path elements are prefixes (depends on the - # virtual path of the IIS application). +# virtual path of the IIS application). import sys # Adjust python path if this is not a system-wide install -#sys.path.insert(0, r'C:\your\custom\hg\build\lib.win32-2.7') +# sys.path.insert(0, r'C:\your\custom\hg\build\lib.win32-2.7') # Enable tracing. Run 'python -m win32traceutil' to debug if getattr(sys, 'isapidllhandle', None) is not None: import win32traceutil - win32traceutil.SetupForPrint # silence unused import warning + + win32traceutil.SetupForPrint # silence unused import warning import isapi_wsgi from mercurial.hgweb.hgwebdir_mod import hgwebdir @@ -104,13 +105,15 @@ # Example tweak: Replace isapi_wsgi's handler to provide better error message # Other stuff could also be done here, like logging errors etc. class WsgiHandler(isapi_wsgi.IsapiWsgiHandler): - error_status = '500 Internal Server Error' # less silly error message + error_status = '500 Internal Server Error' # less silly error message + isapi_wsgi.IsapiWsgiHandler = WsgiHandler # Only create the hgwebdir instance once application = hgwebdir(hgweb_config) + def handler(environ, start_response): # Translate IIS's weird URLs @@ -125,10 +128,13 @@ return application(environ, start_response) + def __ExtensionFactory__(): return isapi_wsgi.ISAPISimpleHandler(handler) -if __name__=='__main__': + +if __name__ == '__main__': from isapi.install import ISAPIParameters, HandleCommandLine + params = ISAPIParameters() HandleCommandLine(params)