Patchwork [3,of,4] hgweb: import wsgicgi at top level

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 19, 2015, 2:18 p.m.
Message ID <3bb7a4cd50f074cb4c8c.1447942736@mimosa>
Download mbox | patch
Permalink /patch/11519/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 19, 2015, 2:18 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1446358175 -32400
#      Sun Nov 01 15:09:35 2015 +0900
# Node ID 3bb7a4cd50f074cb4c8cf5a9b57e8a8e6fdfba13
# Parent  02988a3d85ad846d0c4594395d3b02fec988565c
hgweb: import wsgicgi at top level

There should be no practical reason to delay the import of wsgicgi.

Patch

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -15,7 +15,7 @@  from common import ErrorResponse, permho
 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
 from request import wsgirequest
-import webcommands, protocol, webutil
+import webcommands, protocol, webutil, wsgicgi
 
 perms = {
     'changegroup': 'pull',
@@ -261,7 +261,6 @@  class hgweb(object):
         if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
             raise RuntimeError("This function is only intended to be "
                                "called while running as a CGI script.")
-        import mercurial.hgweb.wsgicgi as wsgicgi
         wsgicgi.launch(self)
 
     def __call__(self, env, respond):
diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -15,7 +15,7 @@  from common import ErrorResponse, get_mt
                    get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
 import hgweb_mod
 from request import wsgirequest
-import webutil
+import webutil, wsgicgi
 
 def cleannames(items):
     return [(util.pconvert(name).strip('/'), path) for name, path in items]
@@ -162,7 +162,6 @@  class hgwebdir(object):
         if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
             raise RuntimeError("This function is only intended to be "
                                "called while running as a CGI script.")
-        import mercurial.hgweb.wsgicgi as wsgicgi
         wsgicgi.launch(self)
 
     def __call__(self, env, respond):