tempy.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:TemPy 作者: Hrabal 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号