changeset 1182:24d553b598e8

Merge with http://hannibal.lr-s.tudelft.nl/~vincent/fcgi/mercurial/fcgi/
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 31 Aug 2005 21:07:36 +0200
parents 8acf62f579d8 (current diff) 4f5001f5b4c3 (diff)
children d9e85a75dbda 2ae9c319e6fe
files mercurial/hgweb.py
diffstat 1 files changed, 10 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb.py	Wed Aug 31 11:58:15 2005 -0700
+++ b/mercurial/hgweb.py	Wed Aug 31 21:07:36 2005 +0200
@@ -910,16 +910,9 @@
                     accept = accept + line[7:].split(',')
             env['HTTP_ACCEPT'] = ','.join(accept)
 
-            save = sys.argv, sys.stderr
-            try:
-                req = hgrequest(self.rfile, self.wfile, env)
-                sys.argv = ["hgweb.py"]
-                if '=' not in query:
-                    sys.argv.append(query)
-                self.send_response(200, "Script output follows")
-                hg.run(req)
-            finally:
-                sys.argv, sys.stderr = save
+            req = hgrequest(self.rfile, self.wfile, env)
+            self.send_response(200, "Script output follows")
+            hg.run(req)
 
     hg = hgweb(repo)
     if use_ipv6:
@@ -936,15 +929,18 @@
 # This is a stopgap
 class hgwebdir:
     def __init__(self, config):
+        def cleannames(items):
+            return [(name.strip('/'), path) for name, path in items]
+
         if type(config) == type([]):
-            self.repos = config
+            self.repos = cleannames(config)
         elif type(config) == type({}):
-            self.repos = config.items()
+            self.repos = cleannames(config.items())
             self.repos.sort()
         else:
             cp = ConfigParser.SafeConfigParser()
             cp.read(config)
-            self.repos = cp.items("paths")
+            self.repos = cleannames(cp.items("paths"))
             self.repos.sort()
 
     def run(self, req=hgrequest()):
@@ -968,7 +964,7 @@
                     pass
                 get = u.config
 
-                url = ('/'.join([req.env["REQUEST_URI"], name])
+                url = ('/'.join([req.env["REQUEST_URI"].split('?')[0], name])
                        .replace("//", "/"))
 
                 yield dict(contact=get("web", "contact") or