[Zope] Getting select contents from parent object

VanL van@lindbergs.org
Wed, 07 Aug 2002 09:53:03 -0600


Here is my try:

In the Apple Object, I have the following method defined:

    def get_apple_type(self):
        typelist = ['No apple types defined']
        for parentObj in self.aq_chain:
            try:
                typelist = parentObj.typelist
                return typelist
            except: continue
        return typelist

I then do the following when I create the object:

    a = Apple.Apple(thisID)
    self._setObject(thisID, a)
    a = self._getOb(thisID)
   
    # Now try to set the typelist property
    PropertyManager.manage_addProperty(a, 'apple_type', 
a.get_apple_type, 'select', None)

I can refresh the product fine, but when I try to add an apple, I get 
the following error:

*Error Type: UnpickleableError*
*Error Value: Cannot pickle objects
*

The traceback is as follows:

**

Traceback (innermost last):
  File C:\lib\ZopeDev\lib\python\ZPublisher\Publish.py, line 150, in publish_module
  File C:\lib\ZopeDev\lib\python\ZPublisher\Publish.py, line 114, in publish
  File C:\lib\ZopeDev\lib\python\Zope\__init__.py, line 159, in zpublisher_exception_hook
  File C:\lib\ZopeDev\lib\python\ZPublisher\Publish.py, line 102, in publish
  File C:\lib\ZopeDev\lib\python\Zope\__init__.py, line 173, in commit
  File C:\lib\ZopeDev\lib\python\ZODB\Transaction.py, line 234, in commit
  File C:\lib\ZopeDev\lib\python\ZODB\Connection.py, line 346, in commit
    (Info: (('Products.OrchardManager.AppleInfo', 'Apple'), '\x00\x00\x00\x00\x00\x00#\xa8', ''))
UnpickleableError: (see above)

Any help?

Thanks,

VanL
* *

* *