From a9879b14387f4ee8439b4fc53ef55602b6a48db2 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Sun, 14 Feb 2010 18:33:01 +0000 Subject: [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 --- django/forms/fields.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'django/forms') diff --git a/django/forms/fields.py b/django/forms/fields.py index c0ee2f0955..12316a1ab1 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -483,7 +483,12 @@ class ImageField(FileField): return None elif not data and initial: return initial - 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. -- cgit v1.3