218 static = os.path.join(templater.templatepath(), 'static') |
218 static = os.path.join(templater.templatepath(), 'static') |
219 fname = virtual[7:] |
219 fname = virtual[7:] |
220 req.write(staticfile(static, fname, req) or |
220 req.write(staticfile(static, fname, req) or |
221 tmpl('error', error='%r not found' % fname)) |
221 tmpl('error', error='%r not found' % fname)) |
222 elif virtual: |
222 elif virtual: |
223 if virtual in dict(self.repos): |
223 while virtual: |
|
224 real = dict(self.repos).get(virtual) |
|
225 if real: |
|
226 break |
|
227 up = virtual.rfind('/') |
|
228 if up < 0: |
|
229 break |
|
230 virtual = virtual[:up] |
|
231 if real: |
224 req.env['REPO_NAME'] = virtual |
232 req.env['REPO_NAME'] = virtual |
225 try: |
233 try: |
226 repo = hg.repository(parentui, real) |
234 repo = hg.repository(parentui, real) |
227 hgweb(repo).run_wsgi(req) |
235 hgweb(repo).run_wsgi(req) |
228 except IOError, inst: |
236 except IOError, inst: |
229 req.write(tmpl("error", error=inst.strerror)) |
237 req.write(tmpl("error", error=inst.strerror)) |
230 except hg.RepoError, inst: |
238 except hg.RepoError, inst: |
231 req.write(tmpl("error", error=str(inst))) |
239 req.write(tmpl("error", error=str(inst))) |
232 else: |
240 else: |
233 subdir=virtual + '/' |
241 subdir=req.env.get("PATH_INFO", "").strip('/') + '/' |
234 if [r for r in self.repos if r[0].startswith(subdir)]: |
242 if [r for r in self.repos if r[0].startswith(subdir)]: |
235 makeindex(req, subdir) |
243 makeindex(req, subdir) |
236 else: |
244 else: |
237 req.write(tmpl("notfound", repo=virtual)) |
245 req.write(tmpl("notfound", repo=virtual)) |
238 else: |
246 else: |