Opened 8 years ago
Last modified 8 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 )
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.
Note:
See TracTickets
for help on using tickets.
Did you find this to be a problem in practice?