Opened 8 years ago

Closed 8 years ago

#26646 closed New feature (fixed)

Add IOBase methods required by TextIOWrapper to FileProxyMixin.

Reported by: Simon Charette Owned by: Simon Charette
Component: File uploads/storage Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It should be possible to use File objects returned by FileField in a io.TextIOWrapper.

e.g.

import csv
from io import TextIOWrapper

with TextIOWrapper(model_instance.csv_file, 'utf-8') as wrapper:
    reader = csv.reader(wrapper)
    ...

This requires adding the missing readable(), writable() methods and making the seekable() method of FileProxyMixin() available even on Python 2 (#24963 added it for Python 3 only).

Change History (4)

comment:1 by Simon Charette, 8 years ago

Has patch: set

comment:2 by Tim Graham, 8 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Tim Graham, 8 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Simon Charette <charette.s@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 4f474607:

Fixed #26646 -- Added IOBase methods required by TextIOWrapper to File.

Thanks Tim for the review.

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