summaryrefslogtreecommitdiff
path: root/tests/modeltests/model_forms
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2010-02-14 18:33:01 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2010-02-14 18:33:01 +0000
commita9879b14387f4ee8439b4fc53ef55602b6a48db2 (patch)
treed9dcfc91375b2a96b31c61583b3fd7faa2955270 /tests/modeltests/model_forms
parent166405b2e4197fba7d5638ee732f2170f8647f62 (diff)
[1.1.X] Fixed #6054: work around PIL's installation brokeness by detecting either of the two ways it can end up being installed.
Backport of [12429] from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12430 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/model_forms')
-rw-r--r--tests/modeltests/model_forms/models.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py
index 0fd24c18ad..92e05e19ef 100644
--- a/tests/modeltests/model_forms/models.py
+++ b/tests/modeltests/model_forms/models.py
@@ -99,11 +99,15 @@ 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.
- from PIL import Image, _imaging
+ # 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
+
test_images = True
class ImageFile(models.Model):