Show More
@@ -73,12 +73,26 b' class hgwebdir(object):' | |||||
73 |
|
73 | |||
74 | try: |
|
74 | try: | |
75 | try: |
|
75 | try: | |
|
76 | ||||
76 | virtual = req.env.get("PATH_INFO", "").strip('/') |
|
77 | virtual = req.env.get("PATH_INFO", "").strip('/') | |
77 | if virtual.startswith('static/'): |
|
78 | ||
|
79 | # a static file | |||
|
80 | if virtual.startswith('static/') or 'static' in req.form: | |||
78 | static = os.path.join(templater.templatepath(), 'static') |
|
81 | static = os.path.join(templater.templatepath(), 'static') | |
|
82 | if virtual.startswith('static/'): | |||
79 | fname = virtual[7:] |
|
83 | fname = virtual[7:] | |
|
84 | else: | |||
|
85 | fname = req.form['static'][0] | |||
80 | req.write(staticfile(static, fname, req)) |
|
86 | req.write(staticfile(static, fname, req)) | |
81 |
|
|
87 | return | |
|
88 | ||||
|
89 | # top-level index | |||
|
90 | elif not virtual: | |||
|
91 | tmpl = self.templater(req) | |||
|
92 | self.makeindex(req, tmpl) | |||
|
93 | return | |||
|
94 | ||||
|
95 | # nested indexes and hgwebs | |||
82 |
|
|
96 | repos = dict(self.repos) | |
83 |
|
|
97 | while virtual: | |
84 |
|
|
98 | real = repos.get(virtual) | |
@@ -105,17 +119,12 b' class hgwebdir(object):' | |||||
105 |
|
|
119 | break | |
106 |
|
|
120 | virtual = virtual[:up] | |
107 |
|
121 | |||
|
122 | # prefixes not found | |||
108 |
|
|
123 | tmpl = self.templater(req) | |
109 |
|
|
124 | req.respond(404, tmpl("notfound", repo=virtual)) | |
110 |
|
|
125 | ||
111 | if req.form.has_key('static'): |
|
126 | except ErrorResponse, err: | |
112 | static = os.path.join(templater.templatepath(), "static") |
|
|||
113 | fname = req.form['static'][0] |
|
|||
114 | req.write(staticfile(static, fname, req)) |
|
|||
115 | else: |
|
|||
116 |
|
|
127 | tmpl = self.templater(req) | |
117 | self.makeindex(req, tmpl) |
|
|||
118 | except ErrorResponse, err: |
|
|||
119 | req.respond(err.code, tmpl('error', error=err.message or '')) |
|
128 | req.respond(err.code, tmpl('error', error=err.message or '')) | |
120 | finally: |
|
129 | finally: | |
121 | tmpl = None |
|
130 | tmpl = None |
General Comments 0
You need to be logged in to leave comments.
Login now