This doesn't need to exist as an inline function in a method.
Minor formatting changes were made as part of the move.
( )
durin42 |
hg-reviewers |
This doesn't need to exist as an inline function in a method.
Minor formatting changes were made as part of the move.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/hgweb/hgwebdir_mod.py (26 lines) |
allow_read = ui.configlist('web', 'allow_read', untrusted=True) | allow_read = ui.configlist('web', 'allow_read', untrusted=True) | ||||
# by default, allow reading if no allow_read option has been set | # by default, allow reading if no allow_read option has been set | ||||
if not allow_read or ismember(ui, user, allow_read): | if not allow_read or ismember(ui, user, allow_read): | ||||
return True | return True | ||||
return False | return False | ||||
def archivelist(ui, nodeid, url): | |||||
allowed = ui.configlist('web', 'allow_archive', untrusted=True) | |||||
archives = [] | |||||
for typ, spec in hgweb_mod.archivespecs.iteritems(): | |||||
if typ in allowed or ui.configbool('web', 'allow' + typ, | |||||
untrusted=True): | |||||
archives.append({ | |||||
'type': typ, | |||||
'extension': spec[2], | |||||
'node': nodeid, | |||||
'url': url, | |||||
}) | |||||
return archives | |||||
class hgwebdir(object): | class hgwebdir(object): | ||||
"""HTTP server for multiple repositories. | """HTTP server for multiple repositories. | ||||
Given a configuration, different repositories will be served depending | Given a configuration, different repositories will be served depending | ||||
on the request path. | on the request path. | ||||
Instances are typically used as WSGI applications. | Instances are typically used as WSGI applications. | ||||
""" | """ | ||||
wsgireq.respond(err, ctype) | wsgireq.respond(err, ctype) | ||||
return tmpl('error', error=err.message or '') | return tmpl('error', error=err.message or '') | ||||
finally: | finally: | ||||
tmpl = None | tmpl = None | ||||
def makeindex(self, wsgireq, tmpl, subdir=""): | def makeindex(self, wsgireq, tmpl, subdir=""): | ||||
req = wsgireq.req | req = wsgireq.req | ||||
def archivelist(ui, nodeid, url): | |||||
allowed = ui.configlist("web", "allow_archive", untrusted=True) | |||||
archives = [] | |||||
for typ, spec in hgweb_mod.archivespecs.iteritems(): | |||||
if typ in allowed or ui.configbool("web", "allow" + typ, | |||||
untrusted=True): | |||||
archives.append({"type": typ, "extension": spec[2], | |||||
"node": nodeid, "url": url}) | |||||
return archives | |||||
def rawentries(subdir="", **map): | def rawentries(subdir="", **map): | ||||
descend = self.ui.configbool('web', 'descend') | descend = self.ui.configbool('web', 'descend') | ||||
collapse = self.ui.configbool('web', 'collapse') | collapse = self.ui.configbool('web', 'collapse') | ||||
seenrepos = set() | seenrepos = set() | ||||
seendirs = set() | seendirs = set() | ||||
for name, path in self.repos: | for name, path in self.repos: | ||||