[Zope3-Users] how to examine parent attributes in add process?

Tom Dossis td at yoma.com.au
Sun Dec 31 00:34:31 EST 2006


Adam Summers wrote:
> Hi all,
> 
> I have an object which when editing, checks for some attributes in the
> parents containing folder by using the following type of code: (this is
> called during a form.Editform call)
> 
>    def _completeValues(self):
>        if self.a is None  and  self.__parent__.def_c == self.c:
>                my_a  = self.__parent__.def_c * 2
>                setattr(self,'a',my_a)
> 
> Of course, for edits, this all works fine. However, how should I examine
> values in the containing object during an Adding process, where
> __parent__ would be None?
> 

Hi Adam,
The context for an AddForm instance is a
zope.app.container.interfaces.IAdding object.  The context for IAdding
is the container.
-Tom


More information about the Zope3-users mailing list