engine.py 文件源码

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

项目:django-wechat-api 作者: crazy-canux 项目源码 文件源码
def get_template(self, template_name, dirs=_dirs_undefined):
        """
        Returns a compiled Template object for the given template name,
        handling template inheritance recursively.
        """
        if dirs is _dirs_undefined:
            dirs = None
        else:
            warnings.warn(
                "The dirs argument of get_template is deprecated.",
                RemovedInDjango20Warning, stacklevel=2)

        template, origin = self.find_template(template_name, dirs)
        if not hasattr(template, 'render'):
            # template needs to be compiled
            template = Template(template, origin, template_name, engine=self)
        return template

    # This method was originally a function defined in django.template.loader.
    # It was moved here in Django 1.8 when encapsulating the Django template
    # engine in this Engine class. It's still called by deprecated code but it
    # will be removed in Django 2.0. It's superseded by a new render_to_string
    # function in django.template.loader.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号