Déplacement pour eggification.
[Plinn.git] / Products / Plinn / skins / custom_control / folder_paste_control.py
diff --git a/Products/Plinn/skins/custom_control/folder_paste_control.py b/Products/Plinn/skins/custom_control/folder_paste_control.py
new file mode 100755 (executable)
index 0000000..f302d9f
--- /dev/null
@@ -0,0 +1,19 @@
+##parameters=**kw
+##title=Paste objects to a folder from the clipboard
+##
+from Products.CMFDefault.exceptions import CopyError
+from Products.CMFDefault.exceptions import zExceptions_Unauthorized
+
+if context.cb_dataValid:
+       try:
+               result = context.manage_pasteObjects(context.REQUEST['__cp'])
+               return context.setStatus( True, 'Item%s pasted.' %
+                                                                               ( len(result) != 1 and 's' or '' ) )
+       except CopyError:
+               return context.setStatus(False, 'CopyError: Paste failed.')
+       except zExceptions_Unauthorized:
+               return context.setStatus(False, 'Unauthorized: Paste failed.')
+       except KeyError :
+               return context.setStatus(False, 'Please copy or cut one or more items to paste first.')
+else:
+       return context.setStatus(False, 'Please copy or cut one or more items to paste first.')