[Zope-CVS] CVS: Products/ExternalEditor - CHANGES.txt:1.28 ExternalEditor.py:1.17 manage_main.dtml:1.3

Casey Duncan casey@zope.com
Sun, 18 Aug 2002 22:59:24 -0400


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

Modified Files:
	CHANGES.txt ExternalEditor.py manage_main.dtml 
Log Message:
Fixed 2.3 compatibility
Changed manage_main patch to hide pencils if you don't have "Use external
editor" permission


=== Products/ExternalEditor/CHANGES.txt 1.27 => 1.28 ===
--- Products/ExternalEditor/CHANGES.txt:1.27	Wed Jul 24 22:55:38 2002
+++ Products/ExternalEditor/CHANGES.txt	Sun Aug 18 22:59:23 2002
@@ -3,7 +3,7 @@
     - External editing is now governed by the "Use external editor" permission
       to allow non-managers to use it. Users must also have the permissions to
       edit/modify the objects they edit, plus do WebDAV locking if desired.
-      Thanks to Reineke.
+      Thanks to Reineke and others.
 
     - Unix editor command line parsing is much more robust now and properly
       handles quoted arguments. You can also specify the "$1" placeholder in the


=== Products/ExternalEditor/ExternalEditor.py 1.16 => 1.17 ===
--- Products/ExternalEditor/ExternalEditor.py:1.16	Wed Jul 24 22:55:38 2002
+++ Products/ExternalEditor/ExternalEditor.py	Sun Aug 18 22:59:23 2002
@@ -21,9 +21,13 @@
 from Globals import InitializeClass
 from AccessControl.SecurityManagement import getSecurityManager
 from AccessControl.SecurityInfo import ClassSecurityInfo
-from webdav.common import rfc1123_date
-from webdav import Lockable
 from OFS import Image
+try:
+    from webdav.Lockable import wl_isLocked
+except ImportError:
+    # webdav module not available
+    def wl_isLocked(ob):
+        return 0
 
 class ExternalEditor(Acquisition.Implicit):
     """Create a response that encapsulates the data needed by the
@@ -72,7 +76,7 @@
             
         r.append('cookie:%s' % REQUEST.environ.get('HTTP_COOKIE',''))
         
-        if Lockable.wl_isLocked(ob):
+        if wl_isLocked(ob):
             # Object is locked, send down the lock token 
             # owned by this user (if any)
             user_id = security.getUser().getId()


=== Products/ExternalEditor/manage_main.dtml 1.2 => 1.3 ===
--- Products/ExternalEditor/manage_main.dtml:1.2	Fri May 24 15:42:45 2002
+++ Products/ExternalEditor/manage_main.dtml	Sun Aug 18 22:59:23 2002
@@ -134,9 +134,12 @@
   &dtml-sequence-key; <dtml-if title>(&dtml-title;)</dtml-if>
   </a>
   <dtml-let explicit="_.getitem('sequence-item').aq_explicit">
-    <dtml-if expr="_.hasattr(explicit, 'manage_FTPget')
+    <dtml-if expr="(_.hasattr(explicit, 'manage_FTPget')
                    or _.hasattr(explicit, 'read')
-                   or _.hasattr(explicit, 'document_src')">
+                   or _.hasattr(explicit, 'EditableBody')
+                   or _.hasattr(explicit, 'document_src'))
+                   and AUTHENTICATED_USER.has_permission(
+                        'Use external editor', explicit)">
       <a href="&dtml-parent_url;/externalEdit_/&dtml.url_quote-sequence-key;"
          title="Edit using external editor"
       ><img src="&dtml-BASEPATH1;/misc_/ExternalEditor/edit_icon"