comparison mercurial/hgweb/hgwebdir_mod.py @ 36901:006165d4d7e2

hgweb: construct {url} with req.apppath This is how the hgweb WSGI application does it. Let's make the behavior consistent. Differential Revision: https://phab.mercurial-scm.org/D2823
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Mar 2018 15:08:36 -0700
parents 219b23359f4c
children e473a032f38a
comparison
equal deleted inserted replaced
36900:219b23359f4c 36901:006165d4d7e2
494 yield config('web', 'motd') 494 yield config('web', 'motd')
495 495
496 def config(section, name, default=uimod._unset, untrusted=True): 496 def config(section, name, default=uimod._unset, untrusted=True):
497 return self.ui.config(section, name, default, untrusted) 497 return self.ui.config(section, name, default, untrusted)
498 498
499 url = wsgireq.env.get('SCRIPT_NAME', '')
500 if not url.endswith('/'):
501 url += '/'
502
503 vars = {} 499 vars = {}
504 styles, (style, mapfile) = hgweb_mod.getstyle(wsgireq.req, config, 500 styles, (style, mapfile) = hgweb_mod.getstyle(wsgireq.req, config,
505 self.templatepath) 501 self.templatepath)
506 if style == styles[0]: 502 if style == styles[0]:
507 vars['style'] = style 503 vars['style'] = style
515 staticurl += '/' 511 staticurl += '/'
516 512
517 defaults = { 513 defaults = {
518 "encoding": encoding.encoding, 514 "encoding": encoding.encoding,
519 "motd": motd, 515 "motd": motd,
520 "url": url, 516 "url": wsgireq.req.apppath + '/',
521 "logourl": logourl, 517 "logourl": logourl,
522 "logoimg": logoimg, 518 "logoimg": logoimg,
523 "staticurl": staticurl, 519 "staticurl": staticurl,
524 "sessionvars": sessionvars, 520 "sessionvars": sessionvars,
525 "style": style, 521 "style": style,