450 if [r for r in repos if r.startswith(subdir)]: |
450 if [r for r in repos if r.startswith(subdir)]: |
451 return self.makeindex(req, res, tmpl, subdir) |
451 return self.makeindex(req, res, tmpl, subdir) |
452 |
452 |
453 # prefixes not found |
453 # prefixes not found |
454 res.status = '404 Not Found' |
454 res.status = '404 Not Found' |
455 res.setbodygen(tmpl('notfound', repo=virtual)) |
455 res.setbodygen(tmpl.generate('notfound', {'repo': virtual})) |
456 return res.sendresponse() |
456 return res.sendresponse() |
457 |
457 |
458 except ErrorResponse as e: |
458 except ErrorResponse as e: |
459 res.status = statusmessage(e.code, pycompat.bytestr(e)) |
459 res.status = statusmessage(e.code, pycompat.bytestr(e)) |
460 res.setbodygen(tmpl('error', error=e.message or '')) |
460 res.setbodygen(tmpl.generate('error', {'error': e.message or ''})) |
461 return res.sendresponse() |
461 return res.sendresponse() |
462 finally: |
462 finally: |
463 tmpl = None |
463 tmpl = None |
464 |
464 |
465 def makeindex(self, req, res, tmpl, subdir=""): |
465 def makeindex(self, req, res, tmpl, subdir=""): |
483 |
483 |
484 entries = indexentries(self.ui, self.repos, req, |
484 entries = indexentries(self.ui, self.repos, req, |
485 self.stripecount, sortcolumn=sortcolumn, |
485 self.stripecount, sortcolumn=sortcolumn, |
486 descending=descending, subdir=subdir) |
486 descending=descending, subdir=subdir) |
487 |
487 |
488 res.setbodygen(tmpl( |
488 mapping = { |
489 'index', |
489 'entries': entries, |
490 entries=entries, |
490 'subdir': subdir, |
491 subdir=subdir, |
491 'pathdef': hgweb_mod.makebreadcrumb('/' + subdir, self.prefix), |
492 pathdef=hgweb_mod.makebreadcrumb('/' + subdir, self.prefix), |
492 'sortcolumn': sortcolumn, |
493 sortcolumn=sortcolumn, |
493 'descending': descending, |
494 descending=descending, |
494 } |
495 **dict(sort))) |
495 mapping.update(sort) |
496 |
496 res.setbodygen(tmpl.generate('index', mapping)) |
497 return res.sendresponse() |
497 return res.sendresponse() |
498 |
498 |
499 def templater(self, req, nonce): |
499 def templater(self, req, nonce): |
500 |
500 |
501 def motd(**map): |
501 def motd(**map): |