1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #6054: work around PIL's installation brokeness by detecting either of the two ways it can end up being installed.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12429 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss
2010-02-14 18:28:28 +00:00
parent e6740cb39c
commit 7578981626
6 changed files with 41 additions and 14 deletions

View File

@@ -467,7 +467,12 @@ class ImageField(FileField):
f = super(ImageField, self).to_python(data)
if f is None:
return None
from PIL import Image
# Try to import PIL in either of the two ways it can end up installed.
try:
from PIL import Image
except ImportError:
import Image
# We need to get a file object for PIL. We might have a path or we might
# have to read the data into memory.