def _iter_child_renders(self, pretty=False):
for child in self.childs:
if not issubclass(child.__class__, DOMElement):
tempyREPR_cls = self._search_for_view(child)
if tempyREPR_cls:
# If there is a TempyREPR class defined in the child class we make a DOMElement out of it
# this trick is used to avoid circular imports
class Patched(tempyREPR_cls, DOMElement):
pass
child = Patched(child)
try:
yield child.render(pretty=pretty)
except (AttributeError, NotImplementedError):
if isinstance(child, Escaped):
yield child._render
else:
yield html.escape(str(child))
except Exception as ex:
raise ex
评论列表
文章目录