Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failures with jinja StrictUndefined #1729

Open
TomGoBravo opened this issue Oct 15, 2018 · 0 comments
Open

failures with jinja StrictUndefined #1729

TomGoBravo opened this issue Oct 15, 2018 · 0 comments

Comments

@TomGoBravo
Copy link
Contributor

When developing code I like to run with
app.jinja_env.undefined = StrictUndefined

The default templates throw errors such as

File "/usr/local/lib/python3.5/dist-packages/flask_admin/templates/bootstrap2/admin/base.html", line 18, in block "head_css"
{% if admin_view.extra_css %}
jinja2.exceptions.UndefinedError: 'flask_admin.base.AdminIndexView object' has no attribute 'extra_css'

which look easy to fix, I'll make a PR. Do you see any downsides to adding some 'is defined' in the templates?

TomGoBravo added a commit to TomGoBravo/flask-admin that referenced this issue Oct 15, 2018
grep -l -r -P 'if [\w_\.]+ \%' flask_admin/templates/  |xargs perl -i -pe 's/if ([\w_\.]+) \%/if  is defined %/g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant