Flag themes not a bug: template not found


Flag themes version 0.1.3, mainly indicates that the template file cannot be found. After tracking, it is found that there is a place (330 lines) that does not know whether it is a bug or not

pythondef list_templates(self):
    res = []
    ctx = _request_ctx_stack.top
    if USING_BLUEPRINTS and not self.as_blueprint:
        fmt = '_themes/%s/%s'
        fmt = '%s/%s'
    for ident, theme in ctx.app.theme_manager.themes.iteritems():
        res.extend((fmt % (ident, t)).encode("utf8") for t in heme.jinja_loader.list_templates())
    return res

To put:

pythonif USING_BLUEPRINTS and not self.as_blueprint:

Change to:

pythonif USING_BLUEPRINTS and self.as_blueprint:

The template file can be found.

This is the first method.

The second method:

419 lines found:

python    templatepath = '_themes/%s/%s' % (theme, templatename)

Remove this line and add the following 4 lines:

python    if USING_BLUEPRINTS:
        templatepath = '%s/%s' % (theme, templatename)
        templatepath = '_themes/%s/%s' % (theme, templatename)

However, the original author of this plug-in is not updated. Other fans are updating it.

Original text: http://flask123.sinaapp.com/article/56/