[Zope-dev] Copy and paste is not working in custom folder product

Martijn Pieters mj@antraciet.nl
Thu, 25 Nov 1999 15:48:55 +0100


At 04:17 PM 11/25/99 , Martijn Faassen wrote:
>Hi there,
>
>I've created a custom folder which has some addable products defined
>inside it. When I add such a product and try to copy and paste it, I get
>this traceback:
>
>The object test does not support this operation
>
>Traceback (innermost last):
>   File /home/zope/lib/python/ZPublisher/Publish.py, line 214, in
>publish_module
>   File /home/zope/lib/python/ZPublisher/Publish.py, line 179, in publish
>   File /home/zope/lib/python/Zope/__init__.py, line 201, in
>zpublisher_exception_hook
>   File /home/zope/lib/python/ZPublisher/Publish.py, line 165, in publish
>   File /home/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
>     (Object: manage_pasteObjects)
>   File /home/zope/lib/python/ZPublisher/Publish.py, line 102, in
>call_object
>     (Object: manage_pasteObjects)
>   File /home/zope/lib/python/OFS/CopySupport.py, line 199, in
>manage_pasteObjects
>   File /home/zope/lib/python/OFS/CopySupport.py, line 374, in
>_verifyObjectPaste
>Copy Error: (see above)
>
>The folderish product derives from ObjectManager.
>
>The addable products derive from
>     OFS.SimpleItem.Item,
>     Persistent,
>     Acquisition.Implicit,
>     AccessControl.Role.RoleManager
>
>Note that these addable products do have an extra object set inside
>them. Should this one somehow define copysupport as well?
>
>Anybody have any clue why copy and paste is not working? What should I
>investigate? If this post contains too little information I'll just
>release my code with this bug next week so people can study it then. :)

Well, let's start with CopySupport.py.

It'll throw above warning in several cases, but the line number in your 
traceback points to the last case in this method.

It first checks if the meta_type of the object copied is addable to the 
target container (it checks for this with all_meta_types). Then it'll check 
if the user has permission to add the copied object to this container.

One of these two checks fails. You can check this code yourself, it's line 
332 up to 369 of CopySupport.py.

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------