--- 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))