##// END OF EJS Templates
hgweb: move archivelist() of hgwebdir to webutil
Yuya Nishihara -
r37531:40a7c1dd default
parent child Browse files
Show More
@@ -105,22 +105,6 b' def readallowed(ui, req):'
105
105
106 return False
106 return False
107
107
108 def archivelist(ui, nodeid, url):
109 allowed = ui.configlist('web', 'allow_archive', untrusted=True)
110 archives = []
111
112 for typ, spec in webutil.archivespecs.iteritems():
113 if typ in allowed or ui.configbool('web', 'allow' + typ,
114 untrusted=True):
115 archives.append({
116 'type': typ,
117 'extension': spec[2],
118 'node': nodeid,
119 'url': url,
120 })
121
122 return archives
123
124 def rawindexentries(ui, repos, req, subdir=''):
108 def rawindexentries(ui, repos, req, subdir=''):
125 descend = ui.configbool('web', 'descend')
109 descend = ui.configbool('web', 'descend')
126 collapse = ui.configbool('web', 'collapse')
110 collapse = ui.configbool('web', 'collapse')
@@ -241,7 +225,7 b' def rawindexentries(ui, repos, req, subd'
241 'description_sort': description.upper() or "unknown",
225 'description_sort': description.upper() or "unknown",
242 'lastchange': d,
226 'lastchange': d,
243 'lastchange_sort': d[1] - d[0],
227 'lastchange_sort': d[1] - d[0],
244 'archives': archivelist(u, "tip", url),
228 'archives': webutil.archivelist(u, "tip", url),
245 'isdirectory': None,
229 'isdirectory': None,
246 'labels': templateutil.hybridlist(labels, name='label'),
230 'labels': templateutil.hybridlist(labels, name='label'),
247 }
231 }
@@ -49,6 +49,22 b' archivespecs = util.sortdict(('
49 ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)),
49 ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)),
50 ))
50 ))
51
51
52 def archivelist(ui, nodeid, url):
53 allowed = ui.configlist('web', 'allow_archive', untrusted=True)
54 archives = []
55
56 for typ, spec in archivespecs.iteritems():
57 if typ in allowed or ui.configbool('web', 'allow' + typ,
58 untrusted=True):
59 archives.append({
60 'type': typ,
61 'extension': spec[2],
62 'node': nodeid,
63 'url': url,
64 })
65
66 return archives
67
52 def up(p):
68 def up(p):
53 if p[0:1] != "/":
69 if p[0:1] != "/":
54 p = "/" + p
70 p = "/" + p
General Comments 0
You need to be logged in to leave comments. Login now