f302d9fb0e63cfa4365f03ff7d417bbf1063c8c5
[Plinn.git] / skins / custom_control / folder_paste_control.py
1 ##parameters=**kw
2 ##title=Paste objects to a folder from the clipboard
3 ##
4 from Products.CMFDefault.exceptions import CopyError
5 from Products.CMFDefault.exceptions import zExceptions_Unauthorized
6
7 if context.cb_dataValid:
8 try:
9 result = context.manage_pasteObjects(context.REQUEST['__cp'])
10 return context.setStatus( True, 'Item%s pasted.' %
11 ( len(result) != 1 and 's' or '' ) )
12 except CopyError:
13 return context.setStatus(False, 'CopyError: Paste failed.')
14 except zExceptions_Unauthorized:
15 return context.setStatus(False, 'Unauthorized: Paste failed.')
16 except KeyError :
17 return context.setStatus(False, 'Please copy or cut one or more items to paste first.')
18 else:
19 return context.setStatus(False, 'Please copy or cut one or more items to paste first.')