Mercurial > hg
changeset 1142:74d184a40a2e
Cleaned up hgweb.hgwebdir.run()
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Mon, 29 Aug 2005 07:34:35 +0200 |
parents | 033c968d7c66 |
children | 4fffb3d84b7c |
files | mercurial/hgweb.py |
diffstat | 1 files changed, 10 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb.py Mon Aug 29 07:28:39 2005 +0200 +++ b/mercurial/hgweb.py Mon Aug 29 07:34:35 2005 +0200 @@ -934,8 +934,7 @@ def footer(**map): yield tmpl("footer", **map) - templates = templatepath() - m = os.path.join(templates, "map") + m = os.path.join(templatepath(), "map") tmpl = templater(m, common_filters, {"header": header, "footer": footer}) @@ -946,8 +945,8 @@ u.readconfig(file(os.path.join(path, '.hg', 'hgrc'))) get = u.config - url = os.environ["REQUEST_URI"] + "/" + name - url = url.replace("//", "/") + url = ('/'.join([os.environ["REQUEST_URI"], name]) + .replace("//", "/")) yield dict(contact=get("web", "contact") or get("web", "author", "unknown"), @@ -956,25 +955,16 @@ parity=parity, shortdesc=get("web", "description", "unknown"), lastupdate=os.stat(os.path.join(path, ".hg", - "00changelog.d")).st_mtime) + "00changelog.d")).st_mtime) parity = 1 - parity - try: - virtual = os.environ["PATH_INFO"] - except: - virtual = "" - - virtual = virtual.strip('/') - - if len(virtual): + virtual = os.environ.get("PATH_INFO", "").strip('/') + if virtual: real = dict(self.repos).get(virtual) if real: - h = hgweb(real) - h.run() - return + hgweb(real).run() else: - write(tmpl("notfound", repo = virtual)) - return - - write(tmpl("index", entries=entries)) + write(tmpl("notfound", repo=virtual)) + else: + write(tmpl("index", entries=entries))