[Zope3-checkins] SVN: Zope3/trunk/ #327 : File type change clears object content

Julien Anguenot ja at nuxeo.com
Thu May 19 09:31:46 EDT 2005


Log message for revision 30418:
  #327 :  File type change clears object content

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/doc/TODO.txt
  U   Zope3/trunk/src/zope/app/file/browser/file.py
  U   Zope3/trunk/src/zope/app/file/browser/file_upload.pt

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2005-05-19 11:16:24 UTC (rev 30417)
+++ Zope3/trunk/doc/CHANGES.txt	2005-05-19 13:31:46 UTC (rev 30418)
@@ -590,6 +590,8 @@
         logout.) See zope/app/security/browser/loginlogout.txt for details.
 
     Bug Fixes
+    
+      - Fix #327 : File type change clears object content
 
       - Disabled automatic translation of message id's in TAL.
 

Modified: Zope3/trunk/doc/TODO.txt
===================================================================
--- Zope3/trunk/doc/TODO.txt	2005-05-19 11:16:24 UTC (rev 30417)
+++ Zope3/trunk/doc/TODO.txt	2005-05-19 13:31:46 UTC (rev 30418)
@@ -37,8 +37,6 @@
 
   * 302: File objects can't contain non-ascii characters
 
-  * 327: File type change clears object content
-
 Others
 ~~~~~~
 

Modified: Zope3/trunk/src/zope/app/file/browser/file.py
===================================================================
--- Zope3/trunk/src/zope/app/file/browser/file.py	2005-05-19 11:16:24 UTC (rev 30417)
+++ Zope3/trunk/src/zope/app/file/browser/file.py	2005-05-19 13:31:46 UTC (rev 30418)
@@ -173,7 +173,9 @@
 
     def update_object(self, data, contenttype):
         self.context.contentType = contenttype
-        self.context.data = data
+        # Update *only* if a new value is specified
+        if data:
+            self.context.data = data
         formatter = self.request.locale.dates.getFormatter(
             'dateTime', 'medium')
         status = _("Updated on ${date_time}")

Modified: Zope3/trunk/src/zope/app/file/browser/file_upload.pt
===================================================================
--- Zope3/trunk/src/zope/app/file/browser/file_upload.pt	2005-05-19 11:16:24 UTC (rev 30417)
+++ Zope3/trunk/src/zope/app/file/browser/file_upload.pt	2005-05-19 13:31:46 UTC (rev 30418)
@@ -7,7 +7,7 @@
         method="post" enctype="multipart/form-data">
 
     <h3 i18n:translate="">Upload a file</h3>
-
+    
     <div tal:define="errors view/errors" tal:content="errors"
         i18n:translate=""/>
 
@@ -23,11 +23,8 @@
                name="field.contentType"
                size="20"
                type="text"
-               value="" />
-      <tal:span i18n:translate="" tal:condition="context/contentType"
-        >(currently
-        <span i18n:name="content-type"
-              tal:replace="context/contentType"/>)</tal:span>
+               value="" 
+	       tal:attributes="value context/contentType"/>
       </div>
     </div>
 
@@ -42,7 +39,7 @@
                id="field.data"
                name="field.data"
                size="20"
-               type="file" /></div>
+               type="file"/></div>
     </div>
 
     <div class="row">



More information about the Zope3-Checkins mailing list