Mercurial > public > mercurial-scm > hg
diff mercurial/hgweb/hgweb_mod.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 | d3dbdca92458 |
children | 510122bb3c7f |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Sun Nov 08 00:27:15 2009 +0100 +++ b/mercurial/hgweb/hgweb_mod.py Thu Nov 19 10:32:33 2009 +0100 @@ -54,7 +54,9 @@ return self.repo.ui.configlist(section, name, default, untrusted=untrusted) - def refresh(self): + def refresh(self, request=None): + if request: + self.ui.environ = request.environ mtime = get_mtime(self.repo.root) if mtime != self.mtime: self.mtime = mtime @@ -80,7 +82,7 @@ def run_wsgi(self, req): - self.refresh() + self.refresh(req) # work with CGI variables to create coherent structure # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME