Show More
@@ -69,10 +69,6 b' def httphdr(type, file="", size=0):' | |||||
69 | sys.stdout.write('Content-length: %d\n' % size) |
|
69 | sys.stdout.write('Content-length: %d\n' % size) | |
70 | sys.stdout.write('\n') |
|
70 | sys.stdout.write('\n') | |
71 |
|
71 | |||
72 | def httpnotfound(filename): |
|
|||
73 | sys.stdout.write("Status: 404\r\n\r\n") |
|
|||
74 | sys.stdout.write("File not found: (%s)" % (filename, )) |
|
|||
75 |
|
||||
76 | def write(*things): |
|
72 | def write(*things): | |
77 | for thing in things: |
|
73 | for thing in things: | |
78 | if hasattr(thing, "__iter__"): |
|
74 | if hasattr(thing, "__iter__"): | |
@@ -937,23 +933,6 b' class hgwebdir:' | |||||
937 | self.cp.read(config) |
|
933 | self.cp.read(config) | |
938 |
|
934 | |||
939 | def run(self): |
|
935 | def run(self): | |
940 | try: |
|
|||
941 | virtual = os.environ["PATH_INFO"] |
|
|||
942 | except: |
|
|||
943 | virtual = "" |
|
|||
944 |
|
||||
945 | virtual = virtual.strip('/') |
|
|||
946 |
|
||||
947 | if len(virtual): |
|
|||
948 | if self.cp.has_option("paths", virtual): |
|
|||
949 | real = self.cp.get("paths", virtual) |
|
|||
950 | h = hgweb(real) |
|
|||
951 | h.run() |
|
|||
952 | return |
|
|||
953 | else: |
|
|||
954 | httpnotfound(virtual) |
|
|||
955 | return |
|
|||
956 |
|
||||
957 | def header(**map): |
|
936 | def header(**map): | |
958 | yield tmpl("header", **map) |
|
937 | yield tmpl("header", **map) | |
959 |
|
938 | |||
@@ -992,4 +971,21 b' class hgwebdir:' | |||||
992 |
|
971 | |||
993 | parity = 1 - parity |
|
972 | parity = 1 - parity | |
994 |
|
973 | |||
|
974 | try: | |||
|
975 | virtual = os.environ["PATH_INFO"] | |||
|
976 | except: | |||
|
977 | virtual = "" | |||
|
978 | ||||
|
979 | virtual = virtual.strip('/') | |||
|
980 | ||||
|
981 | if len(virtual): | |||
|
982 | if self.cp.has_option("paths", virtual): | |||
|
983 | real = self.cp.get("paths", virtual) | |||
|
984 | h = hgweb(real) | |||
|
985 | h.run() | |||
|
986 | return | |||
|
987 | else: | |||
|
988 | write(tmpl("notfound", repo = virtual)) | |||
|
989 | return | |||
|
990 | ||||
995 | write(tmpl("index", entries=entries)) |
|
991 | write(tmpl("index", entries=entries)) |
@@ -37,4 +37,5 b' filediffparent = "<tr><th class="parent"' | |||||
37 | filelogparent = "<tr><td align="right">parent #rev#: </td><td><a href="?cmd=file;file=#file#;filenode=#node#">#node|short#</a></td></tr>" |
|
37 | filelogparent = "<tr><td align="right">parent #rev#: </td><td><a href="?cmd=file;file=#file#;filenode=#node#">#node|short#</a></td></tr>" | |
38 | indexentry = "<tr class="parity#parity#"><td><a href="#url#">#name#</a></td><td>#shortdesc#</td><td>#author# <i>#email|obfuscate#</i></td><td>#lastupdate|age# ago</td></tr>" |
|
38 | indexentry = "<tr class="parity#parity#"><td><a href="#url#">#name#</a></td><td>#shortdesc#</td><td>#author# <i>#email|obfuscate#</i></td><td>#lastupdate|age# ago</td></tr>" | |
39 | index = index.tmpl |
|
39 | index = index.tmpl | |
40 | archiveentry = "<a href="?cmd=archive;node=#node#;type=#type#">#type#</a> " No newline at end of file |
|
40 | archiveentry = "<a href="?cmd=archive;node=#node#;type=#type#">#type#</a> " | |
|
41 | notfound = notfound.tmpl |
General Comments 0
You need to be logged in to leave comments.
Login now