-
Notifications
You must be signed in to change notification settings - Fork 301
Fix: TypeError: object of type 'NoneType' has no len() #1121
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Fix the error: TypeError: object of type 'NoneType' has no len()
Thanks for bringing this up. The check is odd, and makes sense to do it the other way around. However, I am not sure whether it is at all possible (or should be possible) that data is None. Could you share how you have encountered this error, data being None? |
I got the issue when I create the Response object without any data In my API, I use the following line to return to the front:
In this line when self.data is None
These are the logs
|
Do you think you can write/add a test which reproduces this behavior? The issue is even though your fix looks simple the result is actually an invalid error object according to the JSON:API spec as an error object may not be None. Once there is a reproducing test, it will be easier to figure out what a complete bugfix would be for this issue. |
This has been around for a while. Closing it for now as not being able to process this PR. In case you get around, adding a test to reproduce your error, simply ping me. |
TypeError: object of type 'NoneType' has no len()
Fixes #
Changed the sequence
Description of the Change
Checklist
CHANGELOG.md
updated (only for user relevant changes)AUTHORS