示例#1
0
    def load_template(self, template_name, template_dirs=None):
        extension = splitext(template_name)[1]

        if not extension in JINJA2_DEFAULT_TEMPLATE_EXTENSION:
            return super(LoaderMixin,
                         self).load_template(template_name, template_dirs)
        template = env.get_template(template_name)
        return template, template.filename
示例#2
0
    def load_template(self, template_name, template_dirs=None):
        extension = splitext(template_name)[1]

        if not extension in JINJA2_DEFAULT_TEMPLATE_EXTENSION:
            return super(LoaderMixin, self).load_template(template_name,
                template_dirs)
        template = env.get_template(template_name)
        return template, template.filename
示例#3
0
def get_template(template_name):
    # Jinja will handle this for us, and env also initializes
    # the loader backends the first time it is called.
    from coffin.common import env
    try:
        return env.get_template(template_name)
    except TemplateNotFound:
        raise TemplateDoesNotExist(template_name)
示例#4
0
文件: loader.py 项目: passy/coffin
    def load_template(self, template_name, template_dirs=None):
        """Load a jinja2 file if it ends with the specified ending."""
        jinja2_ending = getattr(settings, 'JINJA2_FILE_EXTENSION', '.jinja2')

        if template_name.endswith(jinja2_ending):
            template = env.get_template(template_name)
            return template, template.filename
        else:
            raise TemplateDoesNotExist(template_name)
示例#5
0
文件: loader.py 项目: spothero/coffin
    def load_template(self, template_name, template_dirs=None):
        extension = splitext(template_name)[1]

        if not extension in JINJA2_DEFAULT_TEMPLATE_EXTENSION:
            return super(LoaderMixin, self).load_template(template_name,
                template_dirs)
        try:
            template = env.get_template(template_name)
        except TemplateNotFound:
            raise TemplateDoesNotExist

        return template, template.filename
示例#6
0
文件: loader.py 项目: MyBook/coffin
 def load_template(self, template_name, template_dirs=None):
     if not template_name.endswith(JINJA2_DEFAULT_TEMPLATE_EXTENSION):
         return super(LoaderMixin,
                      self).load_template(template_name, template_dirs)
     template = env.get_template(template_name)
     return template, template.filename
示例#7
0
文件: loader.py 项目: GaretJax/coffin
def get_template(template_name):
    # Jinja will handle this for us, and env also initializes
    # the loader backends the first time it is called.
    from coffin.common import env
    return env.get_template(template_name)
示例#8
0
def get_template(template_name):
    # Jinja will handle this for us, and env also initializes
    # the loader backends the first time it is called.
    from coffin.common import env
    return env.get_template(template_name)
示例#9
0
文件: loader.py 项目: Eksmo/coffin
 def load_template(self, template_name, template_dirs=None):
     if not template_name.endswith(JINJA2_DEFAULT_TEMPLATE_EXTENSION):
         return super(LoaderMixin, self).load_template(template_name,
             template_dirs)
     template = env.get_template(template_name)
     return template, template.filename