comparison mercurial/hgweb/hgwebdir_mod.py @ 18515:bf8bbbf4aa45 stable

hgwebdir: use web.prefix when creating url breadcrumbs (issue3790) The web.prefix setting was being ignored when creating the index URL breadcrumbs. We only need to fix hgwebdir and not hgweb because hgweb gets the complete URL request, including the prefix, while hgwebdir gets a "subdir" which does not include the prefix. This fix is slightly different of what was suggested on the bug tracker. In there it was suggested to hide the prefix itself from the breadcrumb. I think that would be a better solution, but it would require changing all the index templates and passing the prefix to the template engine, which may be too big a change for stable during the freeze. For now this fixes the problem, and the fix could be improved during the next cycle.
author Angel Ezquerra <angel.ezquerra@gmail.com>
date Thu, 31 Jan 2013 22:36:22 +0100
parents bebb05a7e249
children 76ff3a715cf2
comparison
equal deleted inserted replaced
18514:2a1fac3650a5 18515:bf8bbbf4aa45
131 self.templatepath = self.ui.config('web', 'templates', None) 131 self.templatepath = self.ui.config('web', 'templates', None)
132 self.stripecount = self.ui.config('web', 'stripes', 1) 132 self.stripecount = self.ui.config('web', 'stripes', 1)
133 if self.stripecount: 133 if self.stripecount:
134 self.stripecount = int(self.stripecount) 134 self.stripecount = int(self.stripecount)
135 self._baseurl = self.ui.config('web', 'baseurl') 135 self._baseurl = self.ui.config('web', 'baseurl')
136 prefix = self.ui.config('web', 'prefix', '')
137 if prefix.startswith('/'):
138 prefix = prefix[1:]
139 if prefix.endswith('/'):
140 prefix = prefix[:-1]
141 self.prefix = prefix
136 self.lastrefresh = time.time() 142 self.lastrefresh = time.time()
137 143
138 def run(self): 144 def run(self):
139 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): 145 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
140 raise RuntimeError("This function is only intended to be " 146 raise RuntimeError("This function is only intended to be "
393 399
394 self.refresh() 400 self.refresh()
395 self.updatereqenv(req.env) 401 self.updatereqenv(req.env)
396 402
397 return tmpl("index", entries=entries, subdir=subdir, 403 return tmpl("index", entries=entries, subdir=subdir,
398 pathdef=makebreadcrumb('/' + subdir), 404 pathdef=makebreadcrumb('/' + subdir, self.prefix),
399 sortcolumn=sortcolumn, descending=descending, 405 sortcolumn=sortcolumn, descending=descending,
400 **dict(sort)) 406 **dict(sort))
401 407
402 def templater(self, req): 408 def templater(self, req):
403 409