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

Add csrf_token() to Jinja2 globals #118

Merged
merged 1 commit into from
Jul 3, 2014
Merged

Add csrf_token() to Jinja2 globals #118

merged 1 commit into from
Jul 3, 2014

Conversation

clee704
Copy link
Contributor

@clee704 clee704 commented Mar 27, 2014

Installing csrf_token() in the render context only causes errors in
imported Jinja2 templates. It can be avoided by explicitly importing
templates with context, but it is a cognitive burden to remember which
templates should be imported with context and which don't have to be.

Installing csrf_token() in the render context only causes errors in
imported Jinja2 templates. It can be avoided by explicitly importing
templates with context, but it is a cognitive burden to remember which
templates should be imported with context and which don't have to be.
@lepture lepture added the todo label Mar 27, 2014
@lepture lepture merged commit 57764e3 into pallets-eco:master Jul 3, 2014
lepture added a commit that referenced this pull request Jul 3, 2014
@eriktaubeneck
Copy link
Contributor

Given this, you should probably remove the context processor at https://github.com/clee704/flask-wtf/blob/master/flask_wtf/csrf.py#L139

@lepture
Copy link
Contributor

lepture commented Jul 3, 2014

wow. This patch really sucks. It conflicts with another pull request: #112

@eriktaubeneck
Copy link
Contributor

Lol. FWIW I think the context processor is better. The macro can be solved by passing crsf_token through to the macro.

@clee704
Copy link
Contributor Author

clee704 commented Jul 3, 2014

@lepture I'm so sorry that now tests are failing. At the time of writing this commit, all tests passed. You can checkout 57764e3 and see it yourself.

@clee704
Copy link
Contributor Author

clee704 commented Jul 3, 2014

@eriktaubeneck I didn't remove the context processor because it is necessary to support templates other than Jinja2. Jinja2 globals and context processors don't have to be exclusive.

@clee704
Copy link
Contributor Author

clee704 commented Jul 3, 2014

It seems it's not my commit that causes tests to fail. Check out 9482767.

@lepture
Copy link
Contributor

lepture commented Jul 3, 2014

It seems that we can keep them both.

@eriktaubeneck
Copy link
Contributor

It just seemed redundant at the surface, but you have a good point with other templates.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

3 participants