mercurial/hgweb/hgwebdir_mod.py
changeset 7396 526c40a74bd0
parent 7337 feb0b76b6717
child 7450 79d1bb737c16
equal deleted inserted replaced
7395:e2048f5c7bf5 7396:526c40a74bd0
   114                     return staticfile(static, fname, req)
   114                     return staticfile(static, fname, req)
   115 
   115 
   116                 # top-level index
   116                 # top-level index
   117                 elif not virtual:
   117                 elif not virtual:
   118                     req.respond(HTTP_OK, ctype)
   118                     req.respond(HTTP_OK, ctype)
   119                     return ''.join(self.makeindex(req, tmpl)),
   119                     return self.makeindex(req, tmpl)
   120 
   120 
   121                 # nested indexes and hgwebs
   121                 # nested indexes and hgwebs
   122 
   122 
   123                 repos = dict(self.repos)
   123                 repos = dict(self.repos)
   124                 while virtual:
   124                 while virtual:
   136 
   136 
   137                     # browse subdirectories
   137                     # browse subdirectories
   138                     subdir = virtual + '/'
   138                     subdir = virtual + '/'
   139                     if [r for r in repos if r.startswith(subdir)]:
   139                     if [r for r in repos if r.startswith(subdir)]:
   140                         req.respond(HTTP_OK, ctype)
   140                         req.respond(HTTP_OK, ctype)
   141                         return ''.join(self.makeindex(req, tmpl, subdir)),
   141                         return self.makeindex(req, tmpl, subdir)
   142 
   142 
   143                     up = virtual.rfind('/')
   143                     up = virtual.rfind('/')
   144                     if up < 0:
   144                     if up < 0:
   145                         break
   145                         break
   146                     virtual = virtual[:up]
   146                     virtual = virtual[:up]
   147 
   147 
   148                 # prefixes not found
   148                 # prefixes not found
   149                 req.respond(HTTP_NOT_FOUND, ctype)
   149                 req.respond(HTTP_NOT_FOUND, ctype)
   150                 return ''.join(tmpl("notfound", repo=virtual)),
   150                 return tmpl("notfound", repo=virtual)
   151 
   151 
   152             except ErrorResponse, err:
   152             except ErrorResponse, err:
   153                 req.respond(err.code, ctype)
   153                 req.respond(err.code, ctype)
   154                 return ''.join(tmpl('error', error=err.message or '')),
   154                 return tmpl('error', error=err.message or '')
   155         finally:
   155         finally:
   156             tmpl = None
   156             tmpl = None
   157 
   157 
   158     def makeindex(self, req, tmpl, subdir=""):
   158     def makeindex(self, req, tmpl, subdir=""):
   159 
   159