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

Ian Beatty beatty at physics.umass.edu
Mon Mar 1 16:38:00 EST 2004


On 2004-03-01 3:44 PM, Chris Withers is reputed to have said:

> 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

I presume you mean "for cut, paste, rename, etc." If I remove
PropertyManager, my 'Properties' ZMI tab disappears. I'm not quite sure what
SimpleItem provides for me, but it's in the examples I'm trying to work
from.

>> 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 ;-)

Okay. This is bizarre. I've got a containment hierarchy of several classes;
I'll talk about the top 3. I've got things set up so that I can create
instances of A within my Zope root (or any other "normal" Zope folder), I
can create instances of B and only B within A, and I can create instances of
C and only C within B.

When I try to rename an instance of A, the ZMI gives me the standard
rename-object form; but when I type in a new ID and click 'OK', I get a ZMI
page with a red exclamation mark, an 'OK' button, and nothing else except
the word '_notifyOfCopyTo'. The error log shows a "Copy Error" with the
following traceback:

    Traceback (innermost last):
      Module ZPublisher.Publish, line 100, in publish
      Module ZPublisher.mapply, line 88, in mapply
      Module ZPublisher.Publish, line 40, in call_object
      Module OFS.CopySupport, line 230, in manage_renameObjects
      Module OFS.CopySupport, line 252, in manage_renameObject
    Copy Error: 
    [html snipped]

Now, If I view the ZMI for A, select a contained item of type B, and try to
rename it, it fails but with a different signature: the notification page
says 'The object term_0 does not support this operation' instead of
'_notifyOfCopyTo'. ("term_0 is the ID of the B instance.) The error log
shows a Copy Error with this traceback:

    Traceback (innermost last):
      Module ZPublisher.Publish, line 100, in publish
      Module ZPublisher.mapply, line 88, in mapply
      Module ZPublisher.Publish, line 40, in call_object
      Module OFS.CopySupport, line 230, in manage_renameObjects
      Module OFS.CopySupport, line 247, in manage_renameObject
      Module OFS.CopySupport, line 393, in _verifyObjectPaste
    Copy Error: 
    [html snipped]

Attempting to rename an instance of C within B fails in the same way as
renaming A (i.e., with a '_notifyOfCopyTo').

I've currently got A subclassing ObjectManager, CatalogAware, and
PropertyManager; B subclassing the same plus SimpleItem (just as an
experiment); and C subclassing the same as A. If I remove SimpleItem from
B's list of superclasses, I still get the same set of errors, *except* when
attempting to rename C. Now, I instead get the failure message 'You do not
possess the permission required to call
manage_addProduct/KBProduct/manage_KBCourseAddForm in the context of the
container into which you are pasting, thus you are not able to perform this
operation.' The Error Log traceback is:

    Traceback (innermost last):
      Module ZPublisher.Publish, line 100, in publish
      Module ZPublisher.mapply, line 88, in mapply
      Module ZPublisher.Publish, line 40, in call_object
      Module OFS.CopySupport, line 230, in manage_renameObjects
      Module OFS.CopySupport, line 247, in manage_renameObject
      Module OFS.CopySupport, line 378, in _verifyObjectPaste
    Copy Error: 
    [html snipped]

I'm completely bewildered here. Any suggestions would be tremendously
appreciated.

By the way, if this isn't the appropriate venue for this kind of question,
please point me in the right direction. This list seems to focus on Zope's
internals, but the Zope Users list seems a bit low-level for Python-based
product development.

Thanks,  

..Ian

-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- --
Dr. Ian Beatty                           beatty at physics.umass.edu
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/
-- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- --





More information about the Zope-Dev mailing list