What I am trying to do:
I am developing a python product that is has several composed 'helper'
classes. I am trying to setup a method delegation service to have
certain methods of the helper classes called directly on the container.
the helper methods are defined in a text list called external_api of the
helper classes.

The Problem:
The code below works fine if i call it after the object is already in
the zodb. I can call methods of the helper classes through the
container. if however i try to put the method in the containers __init__
method i get an error back from zope about a pickle error. traceback
below. If i remove this method from __init__ everything works fine

Whats going on? help...

Platform: Linux 2.2.16
          Zope 2.1.6

        *** the try/except is only so the method doesn't barf on helper classes
        don't define an external api, there is no hidden error.

   def setup_user_object(self):
        """ setup external api to be called on object """
        # setups a method delegation service for the external api
        # not the most elegant but the one that worked first
        global AuthenticationManager, SessionManager, UserPreferences,
        user_class_map = ( (SessionManager, "self.sm."), )
        for user_class, user_obj_string in user_class_map:
                  for method in user_class.external_api:
                      for key, item in user_class.__dict__.items():
                          if key == method and type(item) ==

        return self.__dict__.keys()

Error Type: UnpickleableError
Error Value: Cannot pickle objects

Traceback (innermost last):
  File /home/ender/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line
214, in publish_module
  File /home/ender/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line
179, in publish
  File /home/ender/Zope-2.1.6-src/lib/python/Zope/__init__.py, line 202,
in zpublisher_exception_hook
  File /home/ender/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line
169, in publish
  File /home/ender/Zope-2.1.6-src/lib/python/ZODB/Transaction.py, line
237, in commit
  File /home/ender/Zope-2.1.6-src/lib/python/ZODB/Connection.py, line
325, in commit
    (Info: (('Products.SIN.UserObject', 'UserObject'),
'\000\000\000\000\000\000\001]', ''))
UnpickleableError: (see above)

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to