Incomplete file interface for django.core.files.temp.TemporaryFile (Windows only)
|Reported by:||tzonghao||Owned by:||tzonghao|
|Severity:||Keywords:||file, seek, tell|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
On Windows, when an uploaded is stored as a temporary file, it is wrapped as django.core.files.temp.TemporaryFile. That class lacks proper seek and tell interfaces which will result in errors when a client of the class is trying to use the file's seek and tell methods. Specifically, the seek implementation only takes one argument, while a file's seek method can take an optional 'whence' argument. And the tell method is missing.
For example, to reproduce the error caused by this,
- Upload any file large enough for it to be stored as a temp file to a server running on Windows.
- Construct a zipfile.ZipFile object with the TemporaryFile instance.
- The ZipFile.__init__ will fail when it tries to call TemporaryFile's seek with two arguments, or when it calls the file's tell method.
Change History (5)
Changed 6 years ago by tzonghao
comment:1 Changed 6 years ago by tzonghao
- Owner changed from nobody to tzonghao
- Status changed from new to assigned
comment:3 Changed 6 years ago by jacob
- Resolution set to duplicate
- Status changed from assigned to closed