Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgwebdir_mod.py @ 37508:30a7b32897f1
hgwebdir: wrap {entries} with mappinggenerator
No bare generator should be put in a template mapping.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 01 Apr 2018 22:11:58 +0900 |
parents | c97b936d8bb5 |
children | 876d54f800cf |
comparison
equal
deleted
inserted
replaced
37507:9b16a67cef56 | 37508:30a7b32897f1 |
---|---|
33 hg, | 33 hg, |
34 profiling, | 34 profiling, |
35 pycompat, | 35 pycompat, |
36 scmutil, | 36 scmutil, |
37 templater, | 37 templater, |
38 templateutil, | |
38 ui as uimod, | 39 ui as uimod, |
39 util, | 40 util, |
40 ) | 41 ) |
41 | 42 |
42 from . import ( | 43 from . import ( |
244 'labels': u.configlist('web', 'labels', untrusted=True), | 245 'labels': u.configlist('web', 'labels', untrusted=True), |
245 } | 246 } |
246 | 247 |
247 yield row | 248 yield row |
248 | 249 |
249 def indexentries(ui, repos, req, stripecount, sortcolumn='', | 250 def _indexentriesgen(context, ui, repos, req, stripecount, sortcolumn, |
250 descending=False, subdir=''): | 251 descending, subdir): |
251 | |
252 rows = rawindexentries(ui, repos, req, subdir=subdir) | 252 rows = rawindexentries(ui, repos, req, subdir=subdir) |
253 | 253 |
254 sortdefault = None, False | 254 sortdefault = None, False |
255 | 255 |
256 if sortcolumn and sortdefault != (sortcolumn, descending): | 256 if sortcolumn and sortdefault != (sortcolumn, descending): |
259 reverse=descending) | 259 reverse=descending) |
260 | 260 |
261 for row, parity in zip(rows, paritygen(stripecount)): | 261 for row, parity in zip(rows, paritygen(stripecount)): |
262 row['parity'] = parity | 262 row['parity'] = parity |
263 yield row | 263 yield row |
264 | |
265 def indexentries(ui, repos, req, stripecount, sortcolumn='', | |
266 descending=False, subdir=''): | |
267 args = (ui, repos, req, stripecount, sortcolumn, descending, subdir) | |
268 return templateutil.mappinggenerator(_indexentriesgen, args=args) | |
264 | 269 |
265 class hgwebdir(object): | 270 class hgwebdir(object): |
266 """HTTP server for multiple repositories. | 271 """HTTP server for multiple repositories. |
267 | 272 |
268 Given a configuration, different repositories will be served depending | 273 Given a configuration, different repositories will be served depending |