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
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.ZipFileobject with the
ZipFile.__init__will fail when it tries to call
seekwith two arguments, or when it calls the file's