django.py 文件源码

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

项目:deb-python-django-compressor 作者: openstack 项目源码 文件源码
def get_nodelist(self, node, original, context):
        if isinstance(node, ExtendsNode):
            try:
                if context is None:
                    context = Context()
                context.template = original
                return handle_extendsnode(node, context)
            except template.TemplateSyntaxError as e:
                raise TemplateSyntaxError(str(e))
            except template.TemplateDoesNotExist as e:
                raise TemplateDoesNotExist(str(e))

        # Check if node is an ```if``` switch with true and false branches
        nodelist = []
        if isinstance(node, Node):
            for attr in node.child_nodelists:
                nodelist += getattr(node, attr, [])
        else:
            nodelist = getattr(node, 'nodelist', [])
        return nodelist
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号