mirror of https://github.com/django/django.git
Removed unicode literals from PIL compat.
This commit is contained in:
parent
33793f7c3e
commit
4ecc6da20b
|
@ -67,6 +67,8 @@ Approach
|
||||||
* ``ImportError`` - Bad install, toss an exception
|
* ``ImportError`` - Bad install, toss an exception
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
@ -100,12 +102,12 @@ def _detect_image_library():
|
||||||
except ImportError as err:
|
except ImportError as err:
|
||||||
# Neither worked, so it's likely not installed.
|
# Neither worked, so it's likely not installed.
|
||||||
raise ImproperlyConfigured(
|
raise ImproperlyConfigured(
|
||||||
_(u"Neither Pillow nor PIL could be imported: %s" % err)
|
_("Neither Pillow nor PIL could be imported: %s" % err)
|
||||||
)
|
)
|
||||||
|
|
||||||
# ``Image.alpha_composite`` was added to Pillow in SHA: e414c6 & is not
|
# ``Image.alpha_composite`` was added to Pillow in SHA: e414c6 & is not
|
||||||
# available in any version of the PIL.
|
# available in any version of the PIL.
|
||||||
if hasattr(PILImage, u'alpha_composite'):
|
if hasattr(PILImage, 'alpha_composite'):
|
||||||
PIL_imaging = False
|
PIL_imaging = False
|
||||||
else:
|
else:
|
||||||
# We're dealing with the PIL. Determine if we're on CPython & if
|
# We're dealing with the PIL. Determine if we're on CPython & if
|
||||||
|
@ -114,7 +116,7 @@ def _detect_image_library():
|
||||||
|
|
||||||
# This is the Alex Approved™ way.
|
# This is the Alex Approved™ way.
|
||||||
# See http://mail.python.org/pipermail//pypy-dev/2011-November/008739.html
|
# See http://mail.python.org/pipermail//pypy-dev/2011-November/008739.html
|
||||||
if platform.python_implementation().lower() == u'cpython':
|
if platform.python_implementation().lower() == 'cpython':
|
||||||
# We're on CPython (likely 2.x). Since a C compiler is needed to
|
# We're on CPython (likely 2.x). Since a C compiler is needed to
|
||||||
# produce a fully-working PIL & will create a ``_imaging`` module,
|
# produce a fully-working PIL & will create a ``_imaging`` module,
|
||||||
# we'll attempt to import it to verify their kit works.
|
# we'll attempt to import it to verify their kit works.
|
||||||
|
@ -122,8 +124,8 @@ def _detect_image_library():
|
||||||
import _imaging as PIL_imaging
|
import _imaging as PIL_imaging
|
||||||
except ImportError as err:
|
except ImportError as err:
|
||||||
raise ImproperlyConfigured(
|
raise ImproperlyConfigured(
|
||||||
_(u"The '_imaging' module for the PIL could not be " +
|
_("The '_imaging' module for the PIL could not be " +
|
||||||
u"imported: %s" % err)
|
"imported: %s" % err)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Try to import ImageFile as well.
|
# Try to import ImageFile as well.
|
||||||
|
|
Loading…
Reference in New Issue