Show More
@@ -643,20 +643,6 b' def _formatfiltererror(arg, filt):' | |||
|
643 | 643 | return (_("template filter '%s' is not compatible with keyword '%s'") |
|
644 | 644 | % (fn, sym)) |
|
645 | 645 | |
|
646 | def _checkeditermaps(darg, d): | |
|
647 | try: | |
|
648 | for v in d: | |
|
649 | if not isinstance(v, dict): | |
|
650 | raise TypeError | |
|
651 | yield v | |
|
652 | except TypeError: | |
|
653 | sym = findsymbolicname(darg) | |
|
654 | if sym: | |
|
655 | raise error.ParseError(_("keyword '%s' is not iterable of mappings") | |
|
656 | % sym) | |
|
657 | else: | |
|
658 | raise error.ParseError(_("%r is not iterable of mappings") % d) | |
|
659 | ||
|
660 | 646 | def _iteroverlaymaps(context, origmapping, newmappings): |
|
661 | 647 | """Generate combined mappings from the original mapping and an iterable |
|
662 | 648 | of partial mappings to override the original""" |
@@ -665,23 +651,14 b' def _iteroverlaymaps(context, origmappin' | |||
|
665 | 651 | lm['index'] = i |
|
666 | 652 | yield lm |
|
667 | 653 | |
|
668 |
def _applymap(context, mapping, d |
|
|
669 | for lm in _iteroverlaymaps(context, mapping, diter): | |
|
654 | def _applymap(context, mapping, d, targ): | |
|
655 | for lm in _iteroverlaymaps(context, mapping, d.itermaps(context)): | |
|
670 | 656 | yield evalrawexp(context, lm, targ) |
|
671 | 657 | |
|
672 | 658 | def runmap(context, mapping, data): |
|
673 | 659 | darg, targ = data |
|
674 |
d = eval |
|
|
675 | # TODO: a generator should be rejected because it is a thunk of lazy | |
|
676 | # string, but we can't because hgweb abuses generator as a keyword | |
|
677 | # that returns a list of dicts. | |
|
678 | # TODO: drop _checkeditermaps() and pass 'd' to mappedgenerator so it | |
|
679 | # can be restarted. | |
|
680 | if isinstance(d, wrapped): | |
|
681 | diter = d.itermaps(context) | |
|
682 | else: | |
|
683 | diter = _checkeditermaps(darg, d) | |
|
684 | return mappedgenerator(_applymap, args=(mapping, diter, targ)) | |
|
660 | d = evalwrapped(context, mapping, darg) | |
|
661 | return mappedgenerator(_applymap, args=(mapping, d, targ)) | |
|
685 | 662 | |
|
686 | 663 | def runmember(context, mapping, data): |
|
687 | 664 | darg, memb = data |
@@ -3212,7 +3212,7 b' Test new-style inline templating:' | |||
|
3212 | 3212 | |
|
3213 | 3213 | |
|
3214 | 3214 | $ hg log -R latesttag -r tip -T '{rev % "a"}\n' |
|
3215 |
hg: parse error: |
|
|
3215 | hg: parse error: 11 is not iterable of mappings | |
|
3216 | 3216 | [255] |
|
3217 | 3217 | $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "a"}\n' |
|
3218 | 3218 | hg: parse error: None is not iterable of mappings |
General Comments 0
You need to be logged in to leave comments.
Login now