[CMF-checkins] SVN: CMF/trunk/C Ensure that BODYFILE in our "faux" request is a file-like object

Tres Seaver tseaver at palladion.com
Thu Nov 3 18:07:35 EST 2005


Log message for revision 39878:
  Ensure that BODYFILE in our "faux" request is a file-like object
  
  o Some objects have a 'PUT' which expect to call its 'read' method.
  

Changed:
  U   CMF/trunk/CHANGES.txt
  U   CMF/trunk/CMFCore/exportimport/content.py
  U   CMF/trunk/CMFCore/exportimport/tests/test_content.py

-=-
Modified: CMF/trunk/CHANGES.txt
===================================================================
--- CMF/trunk/CHANGES.txt	2005-11-03 22:03:47 UTC (rev 39877)
+++ CMF/trunk/CHANGES.txt	2005-11-03 23:07:34 UTC (rev 39878)
@@ -94,6 +94,10 @@
 
   Bug Fixes
 
+    - CMFCore.exportimport.content:  Ensure that BODYFILE in our "faux"
+      request is a file-like object, FBO objects which expect to call its
+      'read' method.
+
     - Got rid of the "CMF Site" and "Configured CMF Site" duality in the ZMI
       add list by removing the "CMF Site" class registration in CMFDefault
       and moving the "Configured CMF Site" registration from CMFSetup into

Modified: CMF/trunk/CMFCore/exportimport/content.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/content.py	2005-11-03 22:03:47 UTC (rev 39877)
+++ CMF/trunk/CMFCore/exportimport/content.py	2005-11-03 23:07:34 UTC (rev 39878)
@@ -319,6 +319,6 @@
             import_context.note('SGAIFA',
                                 'no .ini file for %s/%s' % (subdir, cid))
         else:
-            request = FauxDAVRequest(BODY=data, BODYFILE=data)
+            request = FauxDAVRequest(BODY=data, BODYFILE=StringIO(data))
             response = FauxDAVResponse()
             self.context.PUT(request, response)

Modified: CMF/trunk/CMFCore/exportimport/tests/test_content.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_content.py	2005-11-03 22:03:47 UTC (rev 39877)
+++ CMF/trunk/CMFCore/exportimport/tests/test_content.py	2005-11-03 23:07:34 UTC (rev 39878)
@@ -787,6 +787,8 @@
 
         def PUT(self, REQUEST, RESPONSE):
             self._was_put = REQUEST.get('BODY', '')
+            stream = REQUEST.get('BODYFILE', None)
+            self._was_put_as_read = stream.read()
 
     aware = _TestDAVAware()
     aware._setId(id)



More information about the CMF-checkins mailing list