##// END OF EJS Templates
templater: define interface for objects which act as iterator of mappings
Yuya Nishihara -
r37339:8c31b434 default
parent child Browse files
Show More
@@ -38,6 +38,10 b' class wrapped(object):'
38 __metaclass__ = abc.ABCMeta
38 __metaclass__ = abc.ABCMeta
39
39
40 @abc.abstractmethod
40 @abc.abstractmethod
41 def itermaps(self):
42 """Yield each template mapping"""
43
44 @abc.abstractmethod
41 def show(self, context, mapping):
45 def show(self, context, mapping):
42 """Return a bytes or (possibly nested) generator of bytes representing
46 """Return a bytes or (possibly nested) generator of bytes representing
43 the underlying object
47 the underlying object
@@ -493,7 +497,7 b' def _formatfiltererror(arg, filt):'
493 def runmap(context, mapping, data):
497 def runmap(context, mapping, data):
494 darg, targ = data
498 darg, targ = data
495 d = evalrawexp(context, mapping, darg)
499 d = evalrawexp(context, mapping, darg)
496 if util.safehasattr(d, 'itermaps'):
500 if isinstance(d, wrapped):
497 diter = d.itermaps()
501 diter = d.itermaps()
498 else:
502 else:
499 try:
503 try:
General Comments 0
You need to be logged in to leave comments. Login now