1. George Notaras
  2. django-thumbnail-works

Commits

George Notaras  committed a62ade0

Set failover imports for PIL and cStringIO

  • Participants
  • Parent commits b742a30
  • Branches default

Comments (0)

Files changed (2)

File src/thumbnail_works/image_processors.py

View file
  • Ignore whitespace
 #  limitations under the License.
 #
 
-from PIL import Image, ImageFilter
+try:
+    from PIL import Image, ImageFilter
+except ImportError:
+    import Image
+    import ImageFilter
 
 
 def resize(im, size, upscale):

File src/thumbnail_works/utils.py

View file
  • Ignore whitespace
 #
 
 import os
-import StringIO
-from PIL import Image
+try:
+    from cStringIO import StringIO
+except ImportError:
+    from StringIO import StringIO
+try:
+    from PIL import Image
+except ImportError:
+    import Image
 
 from django.core.files.base import ContentFile
 from django.core.files import File