commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8943 - trunk/gnue-forms/src/input/displayHandlers


From: jamest
Subject: [gnue] r8943 - trunk/gnue-forms/src/input/displayHandlers
Date: Fri, 27 Oct 2006 14:52:57 -0500 (CDT)

Author: jamest
Date: 2006-10-27 14:52:56 -0500 (Fri, 27 Oct 2006)
New Revision: 8943

Modified:
   trunk/gnue-forms/src/input/displayHandlers/Image.py
Log:
pass back a blank image when an image tag value is None


Modified: trunk/gnue-forms/src/input/displayHandlers/Image.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Image.py 2006-10-27 13:19:00 UTC 
(rev 8942)
+++ trunk/gnue-forms/src/input/displayHandlers/Image.py 2006-10-27 19:52:56 UTC 
(rev 8943)
@@ -61,18 +61,18 @@
     @param value: The url of the image to be displayed
     @param editing: Not used
     """
-    image = None
-    if PILImage and self.entry.type.lower() == 'url':
-      try:
-        # PIL doesn't like our openResource function as it's based
-        # upon urlopen which doesn't provide seek.  We'll use the
-        # StringIO function to get around that so that urls can
-        # still be used 
-        urlFile = openResource(value)        
-        fileObject = cStringIO.StringIO(urlFile.read())
-        image = PILImage.open(fileObject)
+    if PILImage and value and self.entry.type.lower() == 'url':
+        try:
+            # PIL doesn't like our openResource function as it's based
+            # upon urlopen which doesn't provide seek.  We'll use the
+            # StringIO function to get around that so that urls can
+            # still be used 
+            urlFile = openResource(value)        
+            fileObject = cStringIO.StringIO(urlFile.read())
+            image = PILImage.open(fileObject)
         
-      except IOError:
+        except IOError:
+            image = PILImage.new("RGB", (1, 1, ))
+    else:
         image = PILImage.new("RGB", (1, 1, ))
-
     return image





reply via email to

[Prev in Thread] Current Thread [Next in Thread]