[Zope-Checkins] CVS: Zope/lib/python/OFS - Image.py:1.142

Martijn Pieters mj@zope.com
Fri, 4 Oct 2002 15:50:34 -0400


Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv4780/lib/python/OFS

Modified Files:
	Image.py 
Log Message:
The fix for Collector #144 broke the ability to create an empty File or
Image object. Fix by only calling manage_upload when we have a non-empty
file.


=== Zope/lib/python/OFS/Image.py 1.141 => 1.142 ===
--- Zope/lib/python/OFS/Image.py:1.141	Wed Aug 21 17:17:58 2002
+++ Zope/lib/python/OFS/Image.py	Fri Oct  4 15:50:34 2002
@@ -55,7 +55,8 @@
 
     # Now we "upload" the data.  By doing this in two steps, we
     # can use a database trick to make the upload more efficient.
-    self._getOb(id).manage_upload(file)
+    if file:
+        self._getOb(id).manage_upload(file)
     if content_type:
         self._getOb(id).content_type=content_type
 
@@ -574,7 +575,8 @@
 
     # Now we "upload" the data.  By doing this in two steps, we
     # can use a database trick to make the upload more efficient.
-    self._getOb(id).manage_upload(file)
+    if file:
+        self._getOb(id).manage_upload(file)
     if content_type:
         self._getOb(id).content_type=content_type