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

Simplify user loading #378

Merged
merged 4 commits into from Dec 30, 2017
Merged

Simplify user loading #378

merged 4 commits into from Dec 30, 2017

Conversation

alanhamlett
Copy link
Collaborator

This does a few things to simplify user loading:

  • Only set user on current request context once in LoginManager._load_user
  • Rename LoginManager.reload_user to LoginManager._update_request_context_with_user
  • Stop loading user from session in LoginManager._update_request_context_with_user
  • Load user from session in LoginManager._load_user
  • Raise exception when loading user when both user_loader and request_loader undefined

@coveralls
Copy link

coveralls commented Dec 30, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 165846b on alanhamlett:simplify-user-loading into 71439b9 on maxcountryman:master.

user = self._request_callback(request)
if user is not None:
app = current_app._get_current_object()
user_loaded_from_request.send(app, user=user)
Copy link
Contributor

Choose a reason for hiding this comment

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

This change makes it impossible to use current_user until _load_user has returned. This is a problem because if you want to use a signal like user_loaded_from_request, accessing current_user causes immediate RecursionError

@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants