[Zope] Re: accessing object from a list constructed in __init__.py
kevin7kal
plone at kevinkal.com
Mon Jul 24 17:28:50 EDT 2006
Thank you everybody for your input and help with this.
What was explained to me and what I missed when reading about
acquisition is that _getattr_ is used by acquisition to return
attributes in context. If your objects are in a list, _getattr_ is not
available, but _getitem_ is used to return the objects. So there are
two solutions and two schools of thought on how to solve this.
Some will over ride _getitem_ so that lists return object.__of__(self) ,
others will wrap the objects manually.
The second solution is the one that I took.
I wrote a method for my class that takes an integer and will return that
element from the list as a wrapped object.
simply
def getObject(self,i):
'''return wrapped object from list'''
object = self.list.__of__(self)
return object
Thanks again everyone for your help.
-Kevin
More information about the Zope
mailing list