[PATCH 3 of 3] Cleanup hgweb and hgwebdir's run method a bit

Eric Hopper hopper at omnifarious.org
Fri Jun 30 12:18:26 CDT 2006


# HG changeset patch
# User Eric Hopper <hopper at omnifarious.org>
# Node ID f4b7d71c1c6025d42890a4384fd4a4ed28ec930e
# Parent  b6975008d44fcf3ed5fbb1867e0bcf5ee3b78da0
Cleanup hgweb and hgwebdir's run method a bit.

diff -r b6975008d44f -r f4b7d71c1c60 mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Fri Jun 30 08:47:41 2006 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Fri Jun 30 09:50:25 2006 -0700
@@ -651,12 +651,12 @@ class hgweb(object):
         return p
 
     def run(self):
-        if os.environ['GATEWAY_INTERFACE'][0:6] != "CGI/1.":
+        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
         from request import wsgiapplication
         def make_web_app():
-            return self.__class__(self.repo, self.reponame)
+            return self
         wsgicgi.launch(wsgiapplication(make_web_app))
 
     def run_wsgi(self, req):
diff -r b6975008d44f -r f4b7d71c1c60 mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py	Fri Jun 30 08:47:41 2006 -0700
+++ b/mercurial/hgweb/hgwebdir_mod.py	Fri Jun 30 09:50:25 2006 -0700
@@ -20,7 +20,6 @@ class hgwebdir(object):
         def cleannames(items):
             return [(name.strip(os.sep), path) for name, path in items]
 
-        self.origconfig = config
         self.motd = ""
         self.repos_sorted = ('name', False)
         if isinstance(config, (list, tuple)):
@@ -48,12 +47,12 @@ class hgwebdir(object):
             self.repos.sort()
 
     def run(self):
-        if os.environ['GATEWAY_INTERFACE'][0:6] != "CGI/1.":
+        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
         from request import wsgiapplication
         def make_web_app():
-            return self.__class__(self.origconfig)
+            return self
         wsgicgi.launch(wsgiapplication(make_web_app))
 
     def run_wsgi(self, req):

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.selenic.com/pipermail/mercurial/attachments/20060630/8f7d66e2/attachment.pgp


More information about the Mercurial mailing list