[Zope-CVS] CVS: Products/ExternalEditor - CHANGES.txt:1.19 ExternalEditor.py:1.10

Casey Duncan casey@zope.com
Fri, 28 Jun 2002 10:45:03 -0400


Update of /cvs-repository/Products/ExternalEditor
In directory cvs.zope.org:/tmp/cvs-serv2709

Modified Files:
	CHANGES.txt ExternalEditor.py 
Log Message:
Now checks if content_type is callable, it apparently is in Plone


=== Products/ExternalEditor/CHANGES.txt 1.18 => 1.19 ===
 
+    - Fixed content_type bug, now checks if it is callable. Thanks to Arnaud 
+      Bienvenu
+
     - Fixed bug with editing binary data on Windows. Thanks to Eric Kamm.
 
     - Fixed bug setting the editor on Posix platforms.


=== Products/ExternalEditor/ExternalEditor.py 1.9 => 1.10 ===
 # Zope External Editor Product by Casey Duncan
 
-from string import join
+from string import join # For Zope 2.3 compatibility
 import Acquisition
 from AccessControl.SecurityManagement import getSecurityManager
 from webdav.common import rfc1123_date
-import base64
 
 class ExternalEditor(Acquisition.Implicit):
     """Create a response that encapsulates the data needed by the
@@ -51,8 +50,11 @@
         r.append('url:%s' % ob.absolute_url())
         r.append('meta_type:%s' % ob.meta_type)
         
-        if hasattr(ob, 'content_type'):
-            r.append('content_type:%s' % ob.content_type)
+        if hasattr(Acquisition.aq_base(ob), 'content_type'):
+            if callable(ob.content_type):
+                r.append('content_type:%s' % ob.content_type())
+            else:
+                r.append('content_type:%s' % ob.content_type)
             
         if REQUEST._auth[-1] == '\n':
             auth = REQUEST._auth[:-1]