I'm doing some work with Five and have an aquisition related issue.
first, zope is zope 2.9.3
The trouble is with accessing the attributes of objects stored in the
number property in class2.
accessing class1.number via class2.method1a is no problem, the problem
seems to stem from constructing a list of objects ala class2.__init__,
if I try to append obj.__of__  in attribute1a I recieve an error that I
can not pickle a wrapped class.  Is there some other trick with
acquisition to be able to access the attributes of an object which is
stored in a list of object constructed in the __init__ function of a class?

import Acquisition

class class1(Acquisition.Explicit):
     ''' a simple class with some attributes and methods'''
     attribute1 = 'attribute 1'
     attribute2 = 'attribute 2'
     _number = ''
     def __init__(self,number2):
         '''simple init for the class'''

     def method1(self):
         '''return a string methd1'''
         mthd1 =  'methd1'
         return mthd1
     def method2(self):
         ''' return a string methd2'''
         mthd2 = 'method2'
         return mthd2
     def _get_number(self):
         return self._number
     number = property(fget=_get_number)

class class2(object):
     ''' a second simple class with some attributes and methods'''
     attribute1a = []
     attribute2a = []
     def __init__(self):
         '''create a list of class1 objects in attribute1a'''
         while i < 5:
             obj = class1(i)

     def method1a(self):
'''instantiate class1 as object and return object usable by zope'''
         obj = class1(5)
         return obj.__of__(self)
     def method2a(self):
         '''returns class1.method1()'''
         c1m1 = class1.method1()
         return c1m1
     attribute1b = property(fget=method1a)
     attribute2b = property(fget=method2a)

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to