Closed nphilipp closed 9 years ago
Can you point out a short example to reproduce the issue so that I can embed it in the test suite? (just using genshi+LazyString without a TGApp should suffice)
Here you go:
from genshi.template.markup import MarkupTemplate
from tg.util import LazyString
markup = """<b xmlns:py="http://genshi.edgewall.org/">${foo}</b>"""
template = MarkupTemplate(markup)
print(template.generate(foo=LazyString(lambda: "bar")))
...
TypeError: 'LazyString' object is not iterable
This will work:
from genshi.template.markup import MarkupTemplate
from tg.util import LazyString
class MyLazyString(LazyString):
def __iter__(self):
return iter(self.eval())
markup = """<b xmlns:py="http://genshi.edgewall.org/">${foo}</b>"""
template = MarkupTemplate(markup)
print(template.generate(foo=MyLazyString(lambda: "bar")))
...
<b>bar</b>
committed as 2c816b9
This is necessary so that Genshi > 0.7 can render LazyString objects with Python 3.