[Zope-dev] Custom class: cut,copy,rename?

Kapil Thangavelu hazmat at objectrealms.net
Thu Mar 4 15:59:59 EST 2004


On Mon, 2004-03-01 at 13:59, Ian Beatty wrote:
> Greetings.
> 
> I've created a package in Python with some basic classes. They work in the
> ZMI, except for the fact that the ZMI paste and rename functionality fails
> with the message "The object xxx does not support this operation."
> 
> I've dug into the source code for standard types ('OFS.Folder',
> 'OFS.SimpleItem', etc.) and discovered some tantalizing bits (such as
> 'manage_renameObject' in 'OFS.CopySupport'), but I can't figure out how to
> put it together to make my classes renameable and pasteable. I'm rather
> surprised that behavior doesn't come automatically when inheriting from the
> standard base classes.
> 
> One of my folderish classes subclasses the following bases:
> 
>     OFS.ObjectManager.ObjectManager
>     Products.ZCatalog.CatalogPathAwareness.CatalogAware
>     OFS.PropertyManager.PropertyManager
>     OFS.SimpleItem.SimpleItem
> 
> Am I not inheriting from the proper set of base classes? Is there an easier
> way? According to the ZDG (2.4 edition, vs. my Zope 2.7),
> OFS.SimpleItem.Item (subclassed by OFS.SimpleItem.SimpleItem) is supposed to
> provide cut-and-paste functionality. So, how might I be breaking it?
> 

as i recall the default copy paste behavior is a bit arcane in that the
verify tries to assert the object is indeed a registered meta_type (ie
reg. in initialize) so that it can verify permissions, see cmfcore
folder code for an example of making a custom container which works
around this (basically just override _verifyObjectPaste), or just
register the objects.

cheers,

-kapil




More information about the Zope-Dev mailing list