mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[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
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user