Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
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)
        try:
            template = env.get_template(template_name)
        except TemplateNotFound:
            raise TemplateDoesNotExist

        return template, template.filename
Ejemplo n.º 6
0
 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
Ejemplo n.º 7
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)
Ejemplo n.º 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)
Ejemplo n.º 9
0
 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