incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/2] git commit: [#6255] change to work with either PIL or Pillow
Date Mon, 20 May 2013 17:26:26 GMT
Updated Branches:
  refs/heads/db/6255 [created] 2ef1046cc


[#6255] change to work with either PIL or Pillow


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d9c9269f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d9c9269f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d9c9269f

Branch: refs/heads/db/6255
Commit: d9c9269ff53fa424b8a94a327f638dae48d364be
Parents: 05d660d
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Mon May 20 17:26:07 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Mon May 20 17:26:07 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/filesystem.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d9c9269f/Allura/allura/model/filesystem.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/filesystem.py b/Allura/allura/model/filesystem.py
index 41a64ab..c56e595 100644
--- a/Allura/allura/model/filesystem.py
+++ b/Allura/allura/model/filesystem.py
@@ -20,7 +20,7 @@ from cStringIO import StringIO
 import logging
 
 import pylons
-import Image
+import PIL
 from gridfs import GridFS
 from tg import config
 from paste.deploy.converters import asint
@@ -136,9 +136,9 @@ class File(MappedClass):
         if square and height != width:
             sz = max(width, height)
             if 'transparency' in image.info:
-                new_image = Image.new('RGBA', (sz,sz))
+                new_image = PIL.Image.new('RGBA', (sz,sz))
             else:
-                new_image = Image.new('RGB', (sz,sz), 'white')
+                new_image = PIL.Image.new('RGB', (sz,sz), 'white')
             if height < width:
                 # image is wider than tall, so center horizontally
                 new_image.paste(image, ((width-height)/2, 0))
@@ -148,7 +148,7 @@ class File(MappedClass):
             image = new_image
 
         if thumbnail_size:
-            image.thumbnail(thumbnail_size, Image.ANTIALIAS)
+            image.thumbnail(thumbnail_size, PIL.Image.ANTIALIAS)
 
         thumbnail_meta = thumbnail_meta or {}
         thumbnail = cls(
@@ -175,9 +175,9 @@ class File(MappedClass):
             return None, None
 
         try:
-            image = Image.open(fp)
+            image = PIL.Image.open(fp)
         except IOError as e:
-            log.error('Error opening image %s %s', filename, e)
+            log.error('Error opening image %s %s', filename, e, exc_info=True)
             return None, None
 
         format = image.format


Mime
View raw message