[Zope-CVS] CVS: Products/PageDesign - PageDesign.py:1.2.2.3

Shane Hathaway shane@cvs.zope.org
Tue, 6 Aug 2002 21:22:21 -0400


Update of /cvs-repository/Products/PageDesign
In directory cvs.zope.org:/tmp/cvs-serv16692

Modified Files:
      Tag: page-redesign-branch
	PageDesign.py 
Log Message:
The Javascript works again on Mozilla and Konqueror.


=== Products/PageDesign/PageDesign.py 1.2.2.2 => 1.2.2.3 ===
 from RawFile import RawFile
 from SlotProvider import SlotProvider
 from ISlotProvider import ISlotProvider
+from IClipboardSource import IClipboardSource
+from IClipboardTarget import IClipboardTarget
 
 # Permission name
 change_page_designs = 'Change Page Designs'
@@ -130,25 +132,21 @@
 
     security.declareProtected(change_page_designs, 'moveElement')
     def moveElement(self, source_path, target_path, RESPONSE=None):
-        """Adds or moves an element to a slot.
+        """Moves an element from one slot to another.
         """
-        if source_path:
-            source = self.getPhysicalRoot().restrictedTraverse(source_path)
-            if not IClipboardSource.isImplementedBy(source):
-                raise DesignError, 'Not a source'
-            getSecurityManager().validate(source, source,
-                                          'cut', source.cut)
-        if target_path:
-            target = self.getPhysicalRoot().restrictedTraverse(target_path)
-            if not IClipboardTarget.isImplementedBy(target):
-                raise DesignError, 'Not a target'
-            getSecurityManager().validate(target, target,
-                                          'paste', target.paste)
-
-        if source is not None:
-            element = source.cut()
-            if target is not None:
-                target.paste([element])
+        source = self.getPhysicalRoot().restrictedTraverse(source_path)
+        if not IClipboardSource.isImplementedBy(source):
+            raise DesignError, 'moveElement: bad or missing source_path'
+        getSecurityManager().validate(source, source, 'cut', source.cut)
+
+        target = self.getPhysicalRoot().restrictedTraverse(target_path)
+        if not IClipboardTarget.isImplementedBy(target):
+            raise DesignError, 'moveElement: bad or missing target_path'
+        getSecurityManager().validate(target, target,
+                                      'paste', target.paste)
+
+        element = source.cut()
+        target.paste([element])
 
         if RESPONSE is not None:
             RESPONSE.redirect(self.absolute_url() + '/editForm')