Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#9404 closed (fixed)

Proxy file-like methods and attributes in UploadedFile objects

Reported by: magneto Owned by: mitsuhiko
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 5 years ago.
readlines, xreadlines, and iter
flesh_out_uploaded_file.diff (4.4 KB) - added by toddobryan 5 years ago.

Download all attachments as: .zip

Change History (10)

Changed 5 years ago by magneto

readlines, xreadlines, and iter

Changed 5 years ago by toddobryan

comment:1 Changed 5 years ago by toddobryan

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from Proxy more File methods in InMemoryUploadedFile to Proxy 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 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:3 Changed 5 years ago by jacob

  • milestone set to 1.1
  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 5 years ago by mitsuhiko

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 5 years ago by mitsuhiko

Actually. the smaller patch is sufficient for 1.1.

comment:6 Changed 5 years ago by mitsuhiko

  • Owner changed from nobody to mitsuhiko

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

comment:7 Changed 5 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [10717].

comment:8 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.