# HG changeset patch # User Ollivier Robert # Date 1125211455 25200 # Node ID 457c23af92bd63d4b688be8d410b9ceb39f06120 # Parent fb008a1a0a32d04eb5765707c350bf91c27d5d18 Use a template for the error message. diff -r fb008a1a0a32 -r 457c23af92bd mercurial/hgweb.py --- a/mercurial/hgweb.py Sat Aug 27 23:44:02 2005 -0700 +++ b/mercurial/hgweb.py Sat Aug 27 23:44:15 2005 -0700 @@ -69,10 +69,6 @@ sys.stdout.write('Content-length: %d\n' % size) sys.stdout.write('\n') -def httpnotfound(filename): - sys.stdout.write("Status: 404\r\n\r\n") - sys.stdout.write("File not found: (%s)" % (filename, )) - def write(*things): for thing in things: if hasattr(thing, "__iter__"): @@ -937,23 +933,6 @@ self.cp.read(config) def run(self): - try: - virtual = os.environ["PATH_INFO"] - except: - virtual = "" - - virtual = virtual.strip('/') - - if len(virtual): - if self.cp.has_option("paths", virtual): - real = self.cp.get("paths", virtual) - h = hgweb(real) - h.run() - return - else: - httpnotfound(virtual) - return - def header(**map): yield tmpl("header", **map) @@ -992,4 +971,21 @@ parity = 1 - parity + try: + virtual = os.environ["PATH_INFO"] + except: + virtual = "" + + virtual = virtual.strip('/') + + if len(virtual): + if self.cp.has_option("paths", virtual): + real = self.cp.get("paths", virtual) + h = hgweb(real) + h.run() + return + else: + write(tmpl("notfound", repo = virtual)) + return + write(tmpl("index", entries=entries)) diff -r fb008a1a0a32 -r 457c23af92bd templates/map --- a/templates/map Sat Aug 27 23:44:02 2005 -0700 +++ b/templates/map Sat Aug 27 23:44:15 2005 -0700 @@ -37,4 +37,5 @@ filelogparent = "parent #rev#: #node|short#" indexentry = "#name##shortdesc##author# #email|obfuscate##lastupdate|age# ago" index = index.tmpl -archiveentry = "#type# " \ No newline at end of file +archiveentry = "#type# " +notfound = notfound.tmpl