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 /django/forms | |
| 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 'django/forms')
| -rw-r--r-- | django/forms/fields.py | 7 |
1 files changed, 6 insertions, 1 deletions
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. |
