Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#10485 closed (duplicate)

Incomplete file interface for django.core.files.temp.TemporaryFile (Windows only)

Reported by: tzonghao Owned by: tzonghao
Component: File uploads/storage Version: 1.0
Severity: Keywords: file, seek, tell
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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,

  1. Upload any file large enough for it to be stored as a temp file to a server running on Windows.
  2. Construct a zipfile.ZipFile object with the TemporaryFile instance.
  3. 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.

Attachments (1)

temp.py.diff (721 bytes ) - added by tzonghao 15 years ago.

Download all attachments as: .zip

Change History (5)

by tzonghao, 15 years ago

Attachment: temp.py.diff added

comment:1 by tzonghao, 15 years ago

Owner: changed from nobody to tzonghao
Status: newassigned

The problem could have been fixed with the above patch. Please review.

comment:2 by Ramiro Morales, 15 years ago

The seek() problem has already been reported in #10047 (no patch attached to that ticket) and the tell() issue has already been reported in #9344 (has a patch).

comment:3 by Jacob, 15 years ago

Resolution: duplicate
Status: assignedclosed

Duplicate of #9344, #10047

comment:4 by Jacob, 13 years ago

milestone: 1.0.3

Milestone 1.0.3 deleted

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