From 2dce8d7a8a0e64f84994b6ac437e2d96920f094e Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 27 Nov 2013 13:23:49 +0200 Subject: [PATCH 1/3] Recommend using Pillow instead of PIL. --- docs/api-guide/fields.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md index 03c5af32a..b0dedd394 100644 --- a/docs/api-guide/fields.md +++ b/docs/api-guide/fields.md @@ -286,7 +286,7 @@ An image representation. Corresponds to `django.forms.fields.ImageField`. -Requires the `PIL` package. +Requires either the `Pillow` package or `PIL` package. It is strongly recommends to use `Pillow` where possible. `PIL` is practically unmaintained and introduces [many problems][pilproblems]. Signature and validation is the same as with `FileField`. @@ -345,3 +345,4 @@ As an example, let's create a field that can be used represent the class name of [ecma262]: http://ecma-international.org/ecma-262/5.1/#sec-15.9.1.15 [strftime]: http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior [iso8601]: http://www.w3.org/TR/NOTE-datetime +[pilproblems]: http://pillow.readthedocs.org/en/latest/about.html From b8f8fb7779dc01b5117e468345aaf99304f807ac Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 27 Nov 2013 13:26:49 +0200 Subject: [PATCH 2/3] Updated the assertion message of the ImageField. --- rest_framework/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 6c07dbb3b..463d296f6 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -966,7 +966,7 @@ class ImageField(FileField): return None from rest_framework.compat import Image - assert Image is not None, 'PIL must be installed for ImageField support' + assert Image is not None, 'Either Pillow or PIL must be installed for ImageField support.' # We need to get a file object for PIL. We might have a path or we might # have to read the data into memory. From c46106c96158a99eb2ff29c464a2fa60aff23122 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 27 Nov 2013 14:47:37 +0200 Subject: [PATCH 3/3] Rephrased documentation changes according to feedback on IRC. --- docs/api-guide/fields.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md index b0dedd394..e05c03061 100644 --- a/docs/api-guide/fields.md +++ b/docs/api-guide/fields.md @@ -286,7 +286,7 @@ An image representation. Corresponds to `django.forms.fields.ImageField`. -Requires either the `Pillow` package or `PIL` package. It is strongly recommends to use `Pillow` where possible. `PIL` is practically unmaintained and introduces [many problems][pilproblems]. +Requires either the `Pillow` package or `PIL` package. The `Pillow` package is recommended, as `PIL` is no longer actively maintained. Signature and validation is the same as with `FileField`. @@ -345,4 +345,3 @@ As an example, let's create a field that can be used represent the class name of [ecma262]: http://ecma-international.org/ecma-262/5.1/#sec-15.9.1.15 [strftime]: http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior [iso8601]: http://www.w3.org/TR/NOTE-datetime -[pilproblems]: http://pillow.readthedocs.org/en/latest/about.html