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

Resolve login when repr-ing AuthenticatedUser #2945

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xmo-odoo
Copy link
Contributor

@xmo-odoo xmo-odoo commented Apr 8, 2024

It's extremely confusing to dump an AuthenticatedUser and get AuthenticatedUser(login=None) even though the AuthenticatedUser is correctly set up, and necessarily has a login.

This risks incurring additional requests, but I think in the contexts where it would be used (mostly at the shell or when debugging services) it's more helpful to actually show the information.

It's extremely confusing to dump an `AuthenticatedUser` and get `AuthenticatedUser(login=None)` even though the `AuthenticatedUser` is correctly set up, and necessarily has a login.

This risks incurring additional requests, but I think in the contexts where it would be used (mostly at the shell or when debugging services) it's more helpful to actually show the information.
@EnricoMi
Copy link
Collaborator

I understand the confusion. But this project favours no unwanted REST calls. This change would cause a request for everyone else using this project, and there would be no way to not have the REST call in this situation.

I think you can easily call update() before printing the user or print user.login to get the desired behaviour.

@xmo-odoo
Copy link
Contributor Author

Then maybe the repr for AuthenticatedUser when no call has been made say something like unknown / unresolved login?

Obviously it's easy to trigger the resolution when you know that's what the issue is, but when you don't and you assume the repr is the actual thing you start trying to debug why your user does not have a login and where that got lost.

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.

None yet

2 participants