# HG changeset patch # User Yuya Nishihara # Date 2010-03-10 15:25:46 # Node ID 9848b39a1472d60855a24c53d8a6bea9f9eecaba # Parent c2e1e637d4da013e21bcc836576e21858a887aeb hgweb: introduce helper method to update req.env diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -284,8 +284,7 @@ class hgwebdir(object): 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 @@ class hgwebdir(object): 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 @@ class hgwebdir(object): "staticurl": staticurl, "sessionvars": sessionvars}) return tmpl + + def updatereqenv(self, env): + if self._baseurl is not None: + env['SCRIPT_NAME'] = self._baseurl