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