Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#9404 closed (fixed)

Proxy file-like methods and attributes in UploadedFile objects

Reported by: magneto Owned by: Armin Ronacher
Component: File uploads/storage Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Simply to make the InMemoryUploadedFile file proxy functions match the same bits as TemporaryUploadedFile .. so they can be used interchangeably

Attachments (2)

uploadedfile_stringio_proxies.diff (694 bytes) - added by magneto 8 years ago.
readlines, xreadlines, and iter
flesh_out_uploaded_file.diff (4.4 KB) - added by Todd O'Bryan 8 years ago.

Download all attachments as: .zip

Change History (10)

Changed 8 years ago by magneto

readlines, xreadlines, and iter

Changed 8 years ago by Todd O'Bryan

comment:1 Changed 8 years ago by Todd O'Bryan

Summary: Proxy more File methods in InMemoryUploadedFileProxy file-like methods and attributes in UploadedFile objects

I went through and proxied every method and attribute listed for file-like objects here:

http://docs.python.org/library/stdtypes.html#file-objects

Of note is that if you try to use a method or attribute that is not implemented for the backing class, you'll get exactly the same error you would get if you tried to call that method or access that attribute on the backing class directly. (For example, if you try to call fileno() on a StringIO object, you'll get exactly the same error as you'd get calling fileno() on an InMemoryUploadedFile because it's backed by a StringIO object.) If any of these methods or attributes are later implemented on the backing objects, they should work.

comment:2 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:3 Changed 8 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:4 Changed 8 years ago by Armin Ronacher

I guess it would make sense to apply the fleshed out version of the patch and refactor the file system for 1.2. There are some really weird things going on.

comment:5 Changed 8 years ago by Armin Ronacher

Actually. the smaller patch is sufficient for 1.1.

comment:6 Changed 8 years ago by Armin Ronacher

Owner: changed from nobody to Armin Ronacher

This is fixed in the branch of Alex and me already.

comment:7 Changed 8 years ago by Jacob

Resolution: fixed
Status: newclosed

Fixed in [10717].

comment:8 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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