Mercurial > hg
changeset 37512:aac97d043e6d
hgweb: drop archivespecs from requestcontext
It's a constant.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 01 Apr 2018 22:33:55 +0900 |
parents | 356e61e82c2a |
children | 40a7c1dd2df9 |
files | mercurial/hgweb/hgweb_mod.py mercurial/hgweb/webcommands.py |
diffstat | 2 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Sun Apr 01 22:32:34 2018 +0900 +++ b/mercurial/hgweb/hgweb_mod.py Sun Apr 01 22:33:55 2018 +0900 @@ -90,8 +90,6 @@ self.req = req self.res = res - self.archivespecs = webutil.archivespecs - self.maxchanges = self.configint('web', 'maxchanges') self.stripecount = self.configint('web', 'stripes') self.maxshortchanges = self.configint('web', 'maxshortchanges') @@ -131,7 +129,7 @@ def archivelist(self, nodeid): allowed = self.configlist('web', 'allow_archive') - for typ, spec in self.archivespecs.iteritems(): + for typ, spec in webutil.archivespecs.iteritems(): if typ in allowed or self.configbool('web', 'allow%s' % typ): yield {'type': typ, 'extension': spec[2], 'node': nodeid} @@ -375,7 +373,7 @@ if cmd == 'archive': fn = req.qsparams['node'] - for type_, spec in rctx.archivespecs.iteritems(): + for type_, spec in webutil.archivespecs.iteritems(): ext = spec[2] if fn.endswith(ext): req.qsparams['node'] = fn[:-len(ext)]
--- a/mercurial/hgweb/webcommands.py Sun Apr 01 22:32:34 2018 +0900 +++ b/mercurial/hgweb/webcommands.py Sun Apr 01 22:33:55 2018 +0900 @@ -1164,7 +1164,7 @@ allowed = web.configlist("web", "allow_archive") key = web.req.qsparams['node'] - if type_ not in web.archivespecs: + if type_ not in webutil.archivespecs: msg = 'Unsupported archive type: %s' % type_ raise ErrorResponse(HTTP_NOT_FOUND, msg) @@ -1193,7 +1193,7 @@ raise ErrorResponse(HTTP_NOT_FOUND, 'file(s) not found: %s' % file) - mimetype, artype, extension, encoding = web.archivespecs[type_] + mimetype, artype, extension, encoding = webutil.archivespecs[type_] web.res.headers['Content-Type'] = mimetype web.res.headers['Content-Disposition'] = 'attachment; filename=%s%s' % (