[PATCH 7 of 15] Let the built-in webserver also use method local variables

vincent at ricardis.tudelft.nl vincent at ricardis.tudelft.nl
Wed Aug 24 16:49:15 CDT 2005


Patch subject is complete summary.


# HG changeset patch
# User Vincent Wagelaar <vincent at ricardis.tudelft.nl>
# Node ID 998d9be9dfc25ab8185ff14694a13ab572d4c763
# Parent  87c9ccd85da175dc06aa359db3e618c1d9d4b0e6
Let the built-in webserver also use method local variables.

diff -r 87c9ccd85da1 -r 998d9be9dfc2 mercurial/hgweb.py
--- a/mercurial/hgweb.py	Wed Aug 24 11:42:22 2005
+++ b/mercurial/hgweb.py	Wed Aug 24 11:50:45 2005
@@ -810,19 +810,11 @@
                     accept = accept + line[7:].split(',')
             env['HTTP_ACCEPT'] = ','.join(accept)
 
-            os.environ.update(env)
-
-            save = sys.argv, sys.stdin, sys.stdout, sys.stderr
-            try:
-                sys.stdin = self.rfile
-                sys.stdout = self.wfile
-                sys.argv = ["hgweb.py"]
-                if '=' not in query:
-                    sys.argv.append(query)
-                self.send_response(200, "Script output follows")
-                hg.run()
-            finally:
-                sys.argv, sys.stdin, sys.stdout, sys.stderr = save
+            sys.argv = ["hgweb.py"]
+            if '=' not in query:
+                sys.argv.append(query)
+            self.send_response(200, "Script output follows")
+            hg.run(self.rfile, self.wfile, env)
 
     hg = hgweb(repo)
     if use_ipv6:


More information about the Mercurial mailing list