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

Avoid closure around request scope #2

Open
belugame opened this issue Apr 19, 2017 · 0 comments
Open

Avoid closure around request scope #2

belugame opened this issue Apr 19, 2017 · 0 comments

Comments

@belugame
Copy link
Collaborator

belugame commented Apr 19, 2017

Currently the order in which this middleware is inserted in respect to AuthenticationMiddleware
and SessionMiddleware does not matter as we use a closure that returns the request-scope only on-demand.

This closure can fail in certain setups (see #1 (comment)) and seems avoidable. Right now nothing speaks against requiring a fixed order where ThreadLocalUserMiddleware is only allowed after the other two.

See: https://github.com/PaesslerAG/django-currentuser/blob/mb-prepare-package/django_currentuser/middleware.py#L29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants