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 a callback hook to set_default_csrf_options for disabling checks … #2778

Merged
merged 1 commit into from
Oct 18, 2016

Conversation

mmerickel
Copy link
Member

…per-request

fixes #2596

Copy link
Member

@ergo ergo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


def test_changing_set_default_csrf_options(self):
from pyramid.interfaces import IDefaultCSRFOptions
config = self._makeOne(autocommit=True)
def callback(request): return True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the single-line function here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is never executed in this test, so it's either that or a pragma or a lambda. A lot of the other tests use this pattern to keep coverage.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callback = lambda x: True

gives pep8 warnings, since you aren't supposed to assign a lambda to a variable...

@digitalresistor
Copy link
Member

LGTM.

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

Successfully merging this pull request may close these issues.

Support hooks for csrf_view/default_csrf_options to allow custom business logic
4 participants