Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgwebdir_mod.py @ 36891:04af43e0a997
hgweb: move archivelist to standalone function
This doesn't need to exist as an inline function in a method.
Minor formatting changes were made as part of the move.
Differential Revision: https://phab.mercurial-scm.org/D2813
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 11 Mar 2018 10:17:58 -0700 |
parents | f8d6d9b29b39 |
children | f370f1b4f12c |
comparison
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() |