##// END OF EJS Templates
Cleaned up hgweb.hgwebdir.run()
Thomas Arendsen Hein -
r1142:74d184a4 default
parent child Browse files
Show More
@@ -934,8 +934,7 b' class hgwebdir:'
934 def footer(**map):
934 def footer(**map):
935 yield tmpl("footer", **map)
935 yield tmpl("footer", **map)
936
936
937 templates = templatepath()
937 m = os.path.join(templatepath(), "map")
938 m = os.path.join(templates, "map")
939 tmpl = templater(m, common_filters,
938 tmpl = templater(m, common_filters,
940 {"header": header, "footer": footer})
939 {"header": header, "footer": footer})
941
940
@@ -946,8 +945,8 b' class hgwebdir:'
946 u.readconfig(file(os.path.join(path, '.hg', 'hgrc')))
945 u.readconfig(file(os.path.join(path, '.hg', 'hgrc')))
947 get = u.config
946 get = u.config
948
947
949 url = os.environ["REQUEST_URI"] + "/" + name
948 url = ('/'.join([os.environ["REQUEST_URI"], name])
950 url = url.replace("//", "/")
949 .replace("//", "/"))
951
950
952 yield dict(contact=get("web", "contact") or
951 yield dict(contact=get("web", "contact") or
953 get("web", "author", "unknown"),
952 get("web", "author", "unknown"),
@@ -956,25 +955,16 b' class hgwebdir:'
956 parity=parity,
955 parity=parity,
957 shortdesc=get("web", "description", "unknown"),
956 shortdesc=get("web", "description", "unknown"),
958 lastupdate=os.stat(os.path.join(path, ".hg",
957 lastupdate=os.stat(os.path.join(path, ".hg",
959 "00changelog.d")).st_mtime)
958 "00changelog.d")).st_mtime)
960
959
961 parity = 1 - parity
960 parity = 1 - parity
962
961
963 try:
962 virtual = os.environ.get("PATH_INFO", "").strip('/')
964 virtual = os.environ["PATH_INFO"]
963 if virtual:
965 except:
966 virtual = ""
967
968 virtual = virtual.strip('/')
969
970 if len(virtual):
971 real = dict(self.repos).get(virtual)
964 real = dict(self.repos).get(virtual)
972 if real:
965 if real:
973 h = hgweb(real)
966 hgweb(real).run()
974 h.run()
975 return
976 else:
967 else:
977 write(tmpl("notfound", repo = virtual))
968 write(tmpl("notfound", repo=virtual))
978 return
969 else:
979
970 write(tmpl("index", entries=entries))
980 write(tmpl("index", entries=entries))
General Comments 0
You need to be logged in to leave comments. Login now