##// END OF EJS Templates
hgweb: drop archivespecs from requestcontext...
Yuya Nishihara -
r37530:aac97d04 default
parent child Browse files
Show More
@@ -90,8 +90,6 b' class requestcontext(object):'
90 self.req = req
90 self.req = req
91 self.res = res
91 self.res = res
92
92
93 self.archivespecs = webutil.archivespecs
94
95 self.maxchanges = self.configint('web', 'maxchanges')
93 self.maxchanges = self.configint('web', 'maxchanges')
96 self.stripecount = self.configint('web', 'stripes')
94 self.stripecount = self.configint('web', 'stripes')
97 self.maxshortchanges = self.configint('web', 'maxshortchanges')
95 self.maxshortchanges = self.configint('web', 'maxshortchanges')
@@ -131,7 +129,7 b' class requestcontext(object):'
131
129
132 def archivelist(self, nodeid):
130 def archivelist(self, nodeid):
133 allowed = self.configlist('web', 'allow_archive')
131 allowed = self.configlist('web', 'allow_archive')
134 for typ, spec in self.archivespecs.iteritems():
132 for typ, spec in webutil.archivespecs.iteritems():
135 if typ in allowed or self.configbool('web', 'allow%s' % typ):
133 if typ in allowed or self.configbool('web', 'allow%s' % typ):
136 yield {'type': typ, 'extension': spec[2], 'node': nodeid}
134 yield {'type': typ, 'extension': spec[2], 'node': nodeid}
137
135
@@ -375,7 +373,7 b' class hgweb(object):'
375
373
376 if cmd == 'archive':
374 if cmd == 'archive':
377 fn = req.qsparams['node']
375 fn = req.qsparams['node']
378 for type_, spec in rctx.archivespecs.iteritems():
376 for type_, spec in webutil.archivespecs.iteritems():
379 ext = spec[2]
377 ext = spec[2]
380 if fn.endswith(ext):
378 if fn.endswith(ext):
381 req.qsparams['node'] = fn[:-len(ext)]
379 req.qsparams['node'] = fn[:-len(ext)]
@@ -1164,7 +1164,7 b' def archive(web):'
1164 allowed = web.configlist("web", "allow_archive")
1164 allowed = web.configlist("web", "allow_archive")
1165 key = web.req.qsparams['node']
1165 key = web.req.qsparams['node']
1166
1166
1167 if type_ not in web.archivespecs:
1167 if type_ not in webutil.archivespecs:
1168 msg = 'Unsupported archive type: %s' % type_
1168 msg = 'Unsupported archive type: %s' % type_
1169 raise ErrorResponse(HTTP_NOT_FOUND, msg)
1169 raise ErrorResponse(HTTP_NOT_FOUND, msg)
1170
1170
@@ -1193,7 +1193,7 b' def archive(web):'
1193 raise ErrorResponse(HTTP_NOT_FOUND,
1193 raise ErrorResponse(HTTP_NOT_FOUND,
1194 'file(s) not found: %s' % file)
1194 'file(s) not found: %s' % file)
1195
1195
1196 mimetype, artype, extension, encoding = web.archivespecs[type_]
1196 mimetype, artype, extension, encoding = webutil.archivespecs[type_]
1197
1197
1198 web.res.headers['Content-Type'] = mimetype
1198 web.res.headers['Content-Type'] = mimetype
1199 web.res.headers['Content-Disposition'] = 'attachment; filename=%s%s' % (
1199 web.res.headers['Content-Disposition'] = 'attachment; filename=%s%s' % (
General Comments 0
You need to be logged in to leave comments. Login now