[Zope] cut and paste or an object

Terry Kerr terry@adroit.net
Wed, 12 Jul 2000 16:02:22 +1000


I have tracked the problem down to order of inheritance, but stull can't solve
it.  My item class inherits from CatalogAware, then ObjectManager.

class Product(CatalogAware,Item,ObjectManager,RoleManager,ProductProperties):

CatalogAware has to be first so that manage_afterAdd, manage_afterClone and
manage_beforeDelete are over ridden so that the object can index and unindex
itself from the catalog.  However, with CatalogAware being first, I get the
traceback below when pasting and object that has been cut.

If I inherit from ObjectManager first, then I can past without problem, but the
class is effectively no longer CatalogAware, and isn't indexed or unindexed
from my catalog.

I still cannot understand why absolute_url() is causing this error.  I wrote a
small function on the object itself, which when called works perfectly.

def blah(self,REQUEST=None):
                """ blah """
                print self.absolute_url()
                print self.url()

Why when absolute_url() is called from with the CatalogAware class does it
cause the error?

Has anybody else been able to paste CatalogAware objects?  Can anyone help with
this...maybe somebody at digital creations?

terry


Andy McKay wrote:

> Sorry, I cant shed any light but I still have the exact same problem. More
> bizarrely I could copy then delete then paste and that worked fine.
>
> ----- Original Message -----
> From: "Terry Kerr" <terry@adroit.net>
> To: <zope@zope.org>
> Sent: Tuesday, July 11, 2000 2:10 AM
> Subject: [Zope] cut and paste or an object
>
> > Hi,
> >
> > I have written a product in python which has two classes.  One is a
> > contrainer class, and the other as an item.  Both classes are
> > catalogAware.  Both have management interfaces which allow
> > cut/copy/paste.  Copy and paste works fine.  But if I paste an object
> > that has been cut, i get the error:
> >
> > Traceback (innermost last):
> >     File /home/tejay/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py,
> > line 214, in publish_module
> >     File /home/tejay/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py,
> > line 179, in publish
> >     File /home/tejay/Zope-2.1.6-src/lib/python/Zope/__init__.py, line
> > 202, in zpublisher_exception_hook
> >       (Object: RoleManager)
> >     File /home/tejay/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py,
> > line 165, in publish
> >     File /home/tejay/Zope-2.1.6-src/lib/python/ZPublisher/mapply.py,
> > line 160, in mapply
> >       (Object: manage_pasteObjects)
> >     File /home/tejay/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py,
> > line 102, in call_object
> >       (Object: manage_pasteObjects)
> >     File /home/tejay/Zope/lib/python/OFS/CopySupport.py, line 225, in
> > manage_pasteObjects
> >       (Object: RoleManager)
> >     File /home/tejay/Zope-2.1.6-src/lib/python/OFS/ObjectManager.py,
> > line 273, in _delObject
> >       (Object: RoleManager)
> >     File
> >
> /home/tejay/Zope-2.1.6-src/lib/python/Products/ZCatalog/CatalogAwareness.py,
> > line 129, in manage_beforeDelete
> >       (Object: CatalogAware)
> >     File
> >
> /home/tejay/Zope-2.1.6-src/lib/python/Products/ZCatalog/CatalogAwareness.py,
> > line 186, in unindex_object
> >       (Object: CatalogAware)
> >     File
> >
> /home/tejay/Zope-2.1.6-src/lib/python/Products/ZCatalog/CatalogAwareness.py,
> > line 156, in url
> >       (Object: CatalogAware)
> >     File /home/tejay/Zope-2.1.6-src/lib/python/OFS/SimpleItem.py, line
> > 319, in absolute_url
> >       (Object: CatalogAware)
> >     File /home/tejay/Zope-2.1.6-src/lib/python/OFS/SimpleItem.py, line
> > 319, in absolute_url
> >       (Object: RoleManager)
> >     File /home/tejay/Zope-2.1.6-src/lib/python/OFS/SimpleItem.py, line
> > 319, in absolute_url
> >       (Object: ElementWithAttributes)
> >     File /home/tejay/Zope/lib/python/OFS/Application.py, line 282, in
> > absolute_url
> >       (Object: ApplicationDefaultPermissions)
> >   AttributeError: aq_acquire
> >
> > The only difference between cutnpast and copynpaste is that cutnpaste
> > will remove the object before setting the new object.  The problem seems
> > to lie in obtaining the absolute_url of the object to be removed which
> > is need by CatalogAware to unindex the object.  I dont understand this,
> > as a direct call to _delObject() from the contrainer class works fine,
> > so I don't understand why a call to _delObject from within the
> > manage_pastObjects method results in the above error.
> >
> > I have been trying to figure this out for days.  Can anyone shead any
> > light on the subject?
> >
> > terry
> >
> >
> >
> > --
> > Terry Kerr (terry@adroit.net)
> > Adroit Internet Solutions Pty Ltd (www.adroit.net)
> > Phone:   +613 9563 4461
> > Fax:     +613 9563 3856
> > Mobile:  +61 414 938 124
> > ICQ:     79303381
> >
> >
> >
> >
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
> >
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

--
Terry Kerr (terry@adroit.net)
Adroit Internet Solutions Pty Ltd (www.adroit.net)
Phone:   +613 9563 4461
Fax:     +613 9563 3856
Mobile:  +61 414 938 124
ICQ:     79303381