-
Notifications
You must be signed in to change notification settings - Fork 13
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
Switch from g.user to current_user #154
Comments
Choice 1 is clearly not viable any further. Flask-Login makes assumptions about users that aren't necessarily compatible with Lastuser, so we should not add a dependency to it. If we take choice 3, we need to demonstrate that Coaster's |
This was referenced Nov 23, 2017
Discussion on implementation details is in #155. |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Coaster currently expects a
g.user
entity inload_models
. If the implementation for hasgeek/baseframe#80 (CRUD views) is moved to Coaster, that will add a second reference tog.user
.However, hasgeek/flask-lastuser#24 proposes replacing
g.user
with acurrent_user
proxy, which must be explicitly imported. This is a problem because Flask-Lastuser depends on Coaster. Coaster can't import from Flask-Lastuser.We can get around this cyclic dependency by making a choice:
Stick with
g.user
. The problems it causes will remain, such as the possibility of an app'sbefore_request
handler attempting to access it before it is set.Coaster should add a dependency on Flask-Login and import
current_user
from there. Flask-Lastuser will need to plugin to Flask-Login and replace the user loading mechanism there.Coaster should provide its own
current_user
proxy, but allow the backing implementation to be replaced (process-wide). Importing Flask-Lastuser into the same process will automatically apply this replacement.The text was updated successfully, but these errors were encountered: