diff mercurial/ui.py @ 9887:38170eeed18c

ui: add environ property to access os.environ or wsgirequest.environ The property returns os.environ by default, and is propagated by ui.copy. During hgweb processing, ui.environ is set to the proper WSGI-request environment, as contained in wsgirequest.environ. For CGI, this is the same as os.environ. The property is meant to be read-only, as with os.environ (generally).
author Sune Foldager <cryo@cyanite.org>
date Thu, 19 Nov 2009 10:32:33 +0100
parents 9e7b2c49d25d
children 89617aacb495
line wrap: on
line diff
--- a/mercurial/ui.py	Sun Nov 08 00:27:15 2009 +0100
+++ b/mercurial/ui.py	Thu Nov 19 10:32:33 2009 +0100
@@ -29,8 +29,11 @@
             self._ocfg = src._ocfg.copy()
             self._trustusers = src._trustusers.copy()
             self._trustgroups = src._trustgroups.copy()
+            self.environ = src.environ
             self.fixconfig()
         else:
+            # shared read-only environment
+            self.environ = os.environ
             # we always trust global config files
             for f in util.rcpath():
                 self.readconfig(f, trust=True)