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

important: user instance is not equal to itself #318

Open
laundmo opened this issue Jul 15, 2020 · 1 comment
Open

important: user instance is not equal to itself #318

laundmo opened this issue Jul 15, 2020 · 1 comment

Comments

@laundmo
Copy link

laundmo commented Jul 15, 2020

comparing any user instance to iteself will return false, which is breaking other extensions like sqlalchemy wtfroms which cannot validate that a user is equal to the user choices.

example code that breaks

a = User.query.first()
if a == a:
    print("everything is good, they are equal")
else:
    print("under no circumstances should python objects not be equal to themselves")

result: "under no circumstances should python objects not be equal to themselves"

apparently the __eq__ override is broken, since it does not use the primary key.

this is in my opinion a issue that will force me to not use flask-user in the future

@Chaostheorie
Copy link

flask user is not really maintained since the start of 2020. If you have an application that uses flask_user and you can't replace flask user with flask login I would recommend you to use a custom UserManager with a custom User class.

Though for the user object specifically a simple workaround like a function that compares the attributes should be enough.

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

No branches or pull requests

2 participants