Re: [Zope-dev] Custom class: cut,copy,rename?
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 ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Custom class: cut,copy,rename?
Ian Beatty wrote: > 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? The order of the parent classes matters. Ie. Some methods are defined in SimpleItem that returns None. Clipped from the source:: # This keeps simple items from acquiring their parents # objectValues, etc., when used in simple tree tags. def objectValues(self, spec=None): return () objectIds=objectItems=objectValues So if SimpleItem is before ObjectManager the traversal order of the parent objects will make shure that you get the wrong methods :-( So this will *not* work: class aSimpleItem( CatalogAware, PropertyManager, SimpleItem.SimpleItem, ObjectManager): This order works: class aSimpleItem( CatalogAware, PropertyManager, SimpleItem): class anObjectManager( ObjectManager, aSimpleItem): regards Max M ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Custom class: cut,copy,rename?
Ian Beatty wrote: OFS.ObjectManager.ObjectManager Products.ZCatalog.CatalogPathAwareness.CatalogAware OFS.PropertyManager.PropertyManager OFS.SimpleItem.SimpleItem I'm pretty sure all you should actually need is: > OFS.ObjectManager.ObjectManager > Products.ZCatalog.CatalogPathAwareness.CatalogAware OFS.SimpleItem.Item (subclassed by OFS.SimpleItem.SimpleItem) is supposed to provide cut-and-paste functionality. So, how might I be breaking it? Show us some error messages, exceptions, types ,values and tracebacks adn amaybe we can help ;-) cheers, Chris ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Custom class: cut,copy,rename?
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? Bewildered, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )