mercurial/hgweb/hgwebdir_mod.py
changeset 36891 04af43e0a997
parent 36890 f8d6d9b29b39
child 36892 f370f1b4f12c
equal deleted inserted replaced
36890:f8d6d9b29b39 36891:04af43e0a997
   130     if not allow_read or ismember(ui, user, allow_read):
   130     if not allow_read or ismember(ui, user, allow_read):
   131         return True
   131         return True
   132 
   132 
   133     return False
   133     return False
   134 
   134 
       
   135 def archivelist(ui, nodeid, url):
       
   136     allowed = ui.configlist('web', 'allow_archive', untrusted=True)
       
   137     archives = []
       
   138 
       
   139     for typ, spec in hgweb_mod.archivespecs.iteritems():
       
   140         if typ in allowed or ui.configbool('web', 'allow' + typ,
       
   141                                            untrusted=True):
       
   142             archives.append({
       
   143                 'type': typ,
       
   144                 'extension': spec[2],
       
   145                 'node': nodeid,
       
   146                 'url': url,
       
   147             })
       
   148 
       
   149     return archives
       
   150 
   135 class hgwebdir(object):
   151 class hgwebdir(object):
   136     """HTTP server for multiple repositories.
   152     """HTTP server for multiple repositories.
   137 
   153 
   138     Given a configuration, different repositories will be served depending
   154     Given a configuration, different repositories will be served depending
   139     on the request path.
   155     on the request path.
   329             tmpl = None
   345             tmpl = None
   330 
   346 
   331     def makeindex(self, wsgireq, tmpl, subdir=""):
   347     def makeindex(self, wsgireq, tmpl, subdir=""):
   332         req = wsgireq.req
   348         req = wsgireq.req
   333 
   349 
   334         def archivelist(ui, nodeid, url):
       
   335             allowed = ui.configlist("web", "allow_archive", untrusted=True)
       
   336             archives = []
       
   337             for typ, spec in hgweb_mod.archivespecs.iteritems():
       
   338                 if typ in allowed or ui.configbool("web", "allow" + typ,
       
   339                                                     untrusted=True):
       
   340                     archives.append({"type": typ, "extension": spec[2],
       
   341                                      "node": nodeid, "url": url})
       
   342             return archives
       
   343 
       
   344         def rawentries(subdir="", **map):
   350         def rawentries(subdir="", **map):
   345 
   351 
   346             descend = self.ui.configbool('web', 'descend')
   352             descend = self.ui.configbool('web', 'descend')
   347             collapse = self.ui.configbool('web', 'collapse')
   353             collapse = self.ui.configbool('web', 'collapse')
   348             seenrepos = set()
   354             seenrepos = set()