diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2010-02-14 18:33:01 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2010-02-14 18:33:01 +0000 |
| commit | a9879b14387f4ee8439b4fc53ef55602b6a48db2 (patch) | |
| tree | d9dcfc91375b2a96b31c61583b3fd7faa2955270 /tests/regressiontests/model_fields/models.py | |
| parent | 166405b2e4197fba7d5638ee732f2170f8647f62 (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/regressiontests/model_fields/models.py')
| -rw-r--r-- | tests/regressiontests/model_fields/models.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/regressiontests/model_fields/models.py b/tests/regressiontests/model_fields/models.py index 462e96874b..2fed5195dd 100644 --- a/tests/regressiontests/model_fields/models.py +++ b/tests/regressiontests/model_fields/models.py @@ -6,12 +6,17 @@ try: except ImportError: from django.utils import _decimal as decimal # Python 2.3 fallback +# Try to import PIL in either of the two ways it can end up installed. +# Checking for the existence of Image is enough for CPython, but for PyPy, +# you need to check for the underlying modules. + try: - # Checking for the existence of Image is enough for CPython, but for PyPy, - # you need to check for the underlying modules. from PIL import Image, _imaging except ImportError: - Image = None + try: + import Image, _imaging + except ImportError: + Image = None from django.core.files.storage import FileSystemStorage from django.db import models |
