#9404 closed (fixed)
Proxy file-like methods and attributes in UploadedFile objects
Reported by: | magneto | Owned by: | Armin Ronacher |
---|---|---|---|
Component: | File uploads/storage | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Simply to make the InMemoryUploadedFile file proxy functions match the same bits as TemporaryUploadedFile .. so they can be used interchangeably
Attachments (2)
Change History (10)
by , 16 years ago
Attachment: | uploadedfile_stringio_proxies.diff added |
---|
by , 16 years ago
Attachment: | flesh_out_uploaded_file.diff added |
---|
comment:1 by , 16 years ago
Summary: | Proxy more File methods in InMemoryUploadedFile → 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:3 by , 16 years ago
milestone: | → 1.1 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:4 by , 16 years ago
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:6 by , 16 years ago
Owner: | changed from | to
---|
This is fixed in the branch of Alex and me already.
readlines, xreadlines, and iter