comparison mercurial/hgweb/hgwebdir_mod.py @ 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 4612cded5176
children 6d87c20cd7a8
comparison
equal deleted inserted replaced
10672:c2e1e637d4da 10673:9848b39a1472
282 "%s%s" % ((not descending and column == sortcolumn) 282 "%s%s" % ((not descending and column == sortcolumn)
283 and "-" or "", column)) 283 and "-" or "", column))
284 for column in sortable] 284 for column in sortable]
285 285
286 self.refresh() 286 self.refresh()
287 if self._baseurl is not None: 287 self.updatereqenv(req.env)
288 req.env['SCRIPT_NAME'] = self._baseurl
289 288
290 return tmpl("index", entries=entries, subdir=subdir, 289 return tmpl("index", entries=entries, subdir=subdir,
291 sortcolumn=sortcolumn, descending=descending, 290 sortcolumn=sortcolumn, descending=descending,
292 **dict(sort)) 291 **dict(sort))
293 292
306 yield config('web', 'motd', '') 305 yield config('web', 'motd', '')
307 306
308 def config(section, name, default=None, untrusted=True): 307 def config(section, name, default=None, untrusted=True):
309 return self.ui.config(section, name, default, untrusted) 308 return self.ui.config(section, name, default, untrusted)
310 309
311 if self._baseurl is not None: 310 self.updatereqenv(req.env)
312 req.env['SCRIPT_NAME'] = self._baseurl
313 311
314 url = req.env.get('SCRIPT_NAME', '') 312 url = req.env.get('SCRIPT_NAME', '')
315 if not url.endswith('/'): 313 if not url.endswith('/'):
316 url += '/' 314 url += '/'
317 315
337 "motd": motd, 335 "motd": motd,
338 "url": url, 336 "url": url,
339 "staticurl": staticurl, 337 "staticurl": staticurl,
340 "sessionvars": sessionvars}) 338 "sessionvars": sessionvars})
341 return tmpl 339 return tmpl
340
341 def updatereqenv(self, env):
342 if self._baseurl is not None:
343 env['SCRIPT_NAME'] = self._baseurl