Commits

George Notaras committed a62ade0

Set failover imports for PIL and cStringIO

Comments (0)

Files changed (2)

src/thumbnail_works/image_processors.py

 #  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):

src/thumbnail_works/utils.py

 #
 
 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