##// END OF EJS Templates
hgweb: use util.sortdict for archivespecs...
av6 -
r30748:319914d5 default
parent child Browse files
Show More
@@ -89,8 +89,6 class requestcontext(object):
89 self.repo = repo
89 self.repo = repo
90 self.reponame = app.reponame
90 self.reponame = app.reponame
91
91
92 self.archives = ('zip', 'gz', 'bz2')
93
94 self.maxchanges = self.configint('web', 'maxchanges', 10)
92 self.maxchanges = self.configint('web', 'maxchanges', 10)
95 self.stripecount = self.configint('web', 'stripes', 1)
93 self.stripecount = self.configint('web', 'stripes', 1)
96 self.maxshortchanges = self.configint('web', 'maxshortchanges', 60)
94 self.maxshortchanges = self.configint('web', 'maxshortchanges', 60)
@@ -126,16 +124,15 class requestcontext(object):
126 return self.repo.ui.configlist(section, name, default,
124 return self.repo.ui.configlist(section, name, default,
127 untrusted=untrusted)
125 untrusted=untrusted)
128
126
129 archivespecs = {
127 archivespecs = util.sortdict((
130 'bz2': ('application/x-bzip2', 'tbz2', '.tar.bz2', None),
128 ('zip', ('application/zip', 'zip', '.zip', None)),
131 'gz': ('application/x-gzip', 'tgz', '.tar.gz', None),
129 ('gz', ('application/x-gzip', 'tgz', '.tar.gz', None)),
132 'zip': ('application/zip', 'zip', '.zip', None),
130 ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)),
133 }
131 ))
134
132
135 def archivelist(self, nodeid):
133 def archivelist(self, nodeid):
136 allowed = self.configlist('web', 'allow_archive')
134 allowed = self.configlist('web', 'allow_archive')
137 for typ in self.archives:
135 for typ, spec in self.archivespecs.iteritems():
138 spec = self.archivespecs[typ]
139 if typ in allowed or self.configbool('web', 'allow%s' % typ):
136 if typ in allowed or self.configbool('web', 'allow%s' % typ):
140 yield {'type': typ, 'extension': spec[2], 'node': nodeid}
137 yield {'type': typ, 'extension': spec[2], 'node': nodeid}
141
138
General Comments 0
You need to be logged in to leave comments. Login now