Opened 6 years ago

Last modified 6 years ago

#29454 closed Cleanup/optimization

Default size for django.core.files.uploadedfile is None and then len will raise error — at Version 1

Reported by: jxltom Owned by: nobody
Component: File uploads/storage Version: 2.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

By default, size of django.core.files.uploadedfile is None and __len__ will return size by default. Calling len will raise TypeError: 'NoneType' object cannot be interpreted as an integer error if size is not assigned specifically.

Can this be handled better? Such not implementing __len__ method if size is set as None.

Change History (1)

comment:1 by Tim Graham, 6 years ago

Description: modified (diff)

Did you find this to be a problem in practice?

Note: See TracTickets for help on using tickets.
Back to Top