Skip to content

Specialised template loaders have no knowledge of the extension commonly associated with their engine #1259

@lenormf

Description

@lenormf

Hi,

When using for example @mako_view("index"), the template engine will not pick up index.mako.

This happens because the BaseTemplate class has a hardcoded list of extensions that its specialisations don't modify accordingly to the extension that is commonly associated with them.

I'm currently working around that issue with the following:

bottle.BaseTemplate.extensions.append("mako")

I think a better way would be for the MakoTemplate, CheetahTemplate and Jinja2Template to pass to their parent class an additional extension upon instantiation. Consequently, the stpl extension should not be kept as a default extension in BaseTemplate, but passed by the SimpleTemplate class.

I can do a PR if you want me to!

HTH.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions