Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgweb_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 | e9ea0f0f05e7 |
children | 0af2fe7b3274 |
comparison
equal
deleted
inserted
replaced
18514:2a1fac3650a5 | 18515:bf8bbbf4aa45 |
---|---|
22 'listkeys': 'pull', | 22 'listkeys': 'pull', |
23 'unbundle': 'push', | 23 'unbundle': 'push', |
24 'pushkey': 'push', | 24 'pushkey': 'push', |
25 } | 25 } |
26 | 26 |
27 def makebreadcrumb(url): | 27 def makebreadcrumb(url, prefix=''): |
28 '''Return a 'URL breadcrumb' list | 28 '''Return a 'URL breadcrumb' list |
29 | 29 |
30 A 'URL breadcrumb' is a list of URL-name pairs, | 30 A 'URL breadcrumb' is a list of URL-name pairs, |
31 corresponding to each of the path items on a URL. | 31 corresponding to each of the path items on a URL. |
32 This can be used to create path navigation entries. | 32 This can be used to create path navigation entries. |
33 ''' | 33 ''' |
34 if url.endswith('/'): | 34 if url.endswith('/'): |
35 url = url[:-1] | 35 url = url[:-1] |
36 if prefix: | |
37 url = '/' + prefix + url | |
36 relpath = url | 38 relpath = url |
37 if relpath.startswith('/'): | 39 if relpath.startswith('/'): |
38 relpath = relpath[1:] | 40 relpath = relpath[1:] |
39 | 41 |
40 breadcrumb = [] | 42 breadcrumb = [] |