X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/blobdiff_plain/3c4367d8e03450e9a73e61f4247145d2b6c86a33..959d888c17d1403d2eeecc19bc4b5e2c8d1debf6:/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 index 0000000..f302d9f --- /dev/null +++ b/Products/Plinn/skins/custom_control/folder_paste_control.py @@ -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.')