# HG changeset patch # User Yuya Nishihara # Date 1268234746 -32400 # Node ID 9848b39a1472d60855a24c53d8a6bea9f9eecaba # Parent c2e1e637d4da013e21bcc836576e21858a887aeb hgweb: introduce helper method to update req.env diff -r c2e1e637d4da -r 9848b39a1472 mercurial/hgweb/hgwebdir_mod.py --- 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