diff options
Diffstat (limited to 'docs/ref/files')
| -rw-r--r-- | docs/ref/files/file.txt | 9 | ||||
| -rw-r--r-- | docs/ref/files/uploads.txt | 13 |
2 files changed, 18 insertions, 4 deletions
diff --git a/docs/ref/files/file.txt b/docs/ref/files/file.txt index 6874936eab..57f8e9eab3 100644 --- a/docs/ref/files/file.txt +++ b/docs/ref/files/file.txt @@ -53,6 +53,15 @@ The ``File`` Class Iterate over the file yielding one line at a time. + .. versionchanged:: 1.8 + + ``File`` now uses `universal newlines`_. The following are + recognized as ending a line: the Unix end-of-line convention + ``'\n'``, the Windows convention ``'\r\n'``, and the old Macintosh + convention ``'\r'``. + + .. _universal newlines: http://www.python.org/dev/peps/pep-0278 + .. method:: chunks([chunk_size=None]) Iterate over the file yielding "chunks" of a given size. ``chunk_size`` diff --git a/docs/ref/files/uploads.txt b/docs/ref/files/uploads.txt index 1b9103bb3b..0817816197 100644 --- a/docs/ref/files/uploads.txt +++ b/docs/ref/files/uploads.txt @@ -82,10 +82,15 @@ Here are some useful attributes of ``UploadedFile``: for line in uploadedfile: do_something_with(line) - However, *unlike* standard Python files, :class:`UploadedFile` only - understands ``\n`` (also known as "Unix-style") line endings. If you know - that you need to handle uploaded files with different line endings, you'll - need to do so in your view. + Lines are split using `universal newlines`_. The following are recognized + as ending a line: the Unix end-of-line convention ``'\n'``, the Windows + convention ``'\r\n'``, and the old Macintosh convention ``'\r'``. + + .. _universal newlines: http://www.python.org/dev/peps/pep-0278 + + .. versionchanged:: 1.8 + + Previously lines were only split on the Unix end-of-line ``'\n'``. Subclasses of ``UploadedFile`` include: |
