From 33793f7c3edd8ff144ff2e9434367267c20af26a Mon Sep 17 00:00:00 2001 From: Daniel Lindsley Date: Tue, 14 May 2013 19:31:16 -0700 Subject: Fixed #19934 - Use of Pillow is now preferred over PIL. This starts the deprecation period for PIL (support to end in 1.8). --- tests/model_forms/models.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'tests/model_forms/models.py') diff --git a/tests/model_forms/models.py b/tests/model_forms/models.py index 25c780f1c2..a79d9b8c5b 100644 --- a/tests/model_forms/models.py +++ b/tests/model_forms/models.py @@ -11,6 +11,7 @@ from __future__ import unicode_literals import os import tempfile +from django.core.exceptions import ImproperlyConfigured from django.core.files.storage import FileSystemStorage from django.db import models from django.utils import six @@ -91,14 +92,7 @@ class TextFile(models.Model): return self.description try: - # If PIL is available, try testing ImageFields. Checking for the existence - # of Image is enough for CPython, but for PyPy, you need to check for the - # underlying modules If PIL is not available, ImageField tests are omitted. - # Try to import PIL in either of the two ways it can end up installed. - try: - from PIL import Image, _imaging - except ImportError: - import Image, _imaging + from django.utils.image import Image test_images = True @@ -137,7 +131,7 @@ try: def __str__(self): return self.description -except ImportError: +except ImproperlyConfigured: test_images = False @python_2_unicode_compatible -- cgit v1.2.1