[Zope3-checkins] CVS: Zope3/src/zope/publisher - browser.py:1.26

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Mar 18 22:17:27 EST 2004


Update of /cvs-repository/Zope3/src/zope/publisher
In directory cvs.zope.org:/tmp/cvs-serv2404/src/zope/publisher

Modified Files:
	browser.py 
Log Message:


If the filename is an empty string (not just None), we do not have a real
uploaded file, so just ignore it. Note that this is a bug and the 'cgi' module
should make the filename be None. Oh well.




=== Zope3/src/zope/publisher/browser.py 1.25 => 1.26 ===
--- Zope3/src/zope/publisher/browser.py:1.25	Sat Mar  6 11:50:39 2004
+++ Zope3/src/zope/publisher/browser.py	Thu Mar 18 22:17:26 2004
@@ -292,11 +292,14 @@
             for item in fslist:
 
                 # Check whether this field is a file upload object
+                # Note: A field exists for files, even if no filename was
+                # passed in and no data was uploaded. Therefore we can only
+                # tell by the empty filename that no upload was made. 
                 key = item.name
                 if (hasattr(item, 'file') and hasattr(item, 'filename')
                     and hasattr(item,'headers')):
                     if (item.file and
-                        (item.filename is not None
+                        (item.filename is not None and item.filename != ''
                          # RFC 1867 says that all fields get a content-type.
                          # or 'content-type' in map(lower, item.headers.keys())
                          )):




More information about the Zope3-Checkins mailing list