Mercurial > hg-stable
changeset 10673:9848b39a1472 stable
hgweb: introduce helper method to update req.env
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 11 Mar 2010 00:25:46 +0900 |
parents | c2e1e637d4da |
children | 6d87c20cd7a8 |
files | mercurial/hgweb/hgwebdir_mod.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py Tue Mar 02 15:08:43 2010 -0500 +++ b/mercurial/hgweb/hgwebdir_mod.py Thu Mar 11 00:25:46 2010 +0900 @@ -284,8 +284,7 @@ for column in sortable] self.refresh() - if self._baseurl is not None: - req.env['SCRIPT_NAME'] = self._baseurl + self.updatereqenv(req.env) return tmpl("index", entries=entries, subdir=subdir, sortcolumn=sortcolumn, descending=descending, @@ -308,8 +307,7 @@ def config(section, name, default=None, untrusted=True): return self.ui.config(section, name, default, untrusted) - if self._baseurl is not None: - req.env['SCRIPT_NAME'] = self._baseurl + self.updatereqenv(req.env) url = req.env.get('SCRIPT_NAME', '') if not url.endswith('/'): @@ -339,3 +337,7 @@ "staticurl": staticurl, "sessionvars": sessionvars}) return tmpl + + def updatereqenv(self, env): + if self._baseurl is not None: + env['SCRIPT_NAME'] = self._baseurl