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

Resource model 'user' field is Optional[User] but it is required. #4321

Closed
marrobi opened this issue Feb 5, 2025 · 0 comments
Closed

Resource model 'user' field is Optional[User] but it is required. #4321

marrobi opened this issue Feb 5, 2025 · 0 comments

Comments

@marrobi
Copy link
Member

marrobi commented Feb 5, 2025

All resources get a value for user, however this is done on save, rather than creation of the object. We should refactor so that the user property gets set on creation of the object, and remove the Optional form here.


The 'user' field is Optional[User], but there is no null check before accessing its attributes. This could lead to an AttributeError if 'user' is None. Add a null check before accessing 'user' attributes.

Originally posted by @Copilot in #3770 (comment)

@marrobi marrobi closed this as completed Feb 5, 2025
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

1 participant