[Zope] Problems accessing container properties at product creation time

robert rottermann robert at redcor.ch
Tue Apr 6 00:38:30 EDT 2004


whil you are in a factory that creates your object it is not yet 
"rooted" in the zodb. It is not yet a "real" object.
However in the manage_afterAdd method which you must override  in your 
class you can do as you please.
Robert

Roy Mathew wrote:

>Hi Folks,
>
>I am trying to create a nested Zope product, and have trouble
>accessing
>properties from the container object...
>
> - I have a class MyFolder that extends Folder.
> - I have a class MyObj that extends (CatalogAware, SimpleItem,
>PropertyManager)
> - Class MyFolder is meant to contain several instances of class
>MyObj.
>
>I am able to create instances of class MyObj properly, and even have
>them be contained within MyFolder (using the inherited _setObject
>method of MyFolder).
>
>My problem is that I cannot seem to get manage_changeProperties to
>work on instances of MyObj at the time of addition (ie: just after I
>do the _setObject call). I have similar problems referencing
>methods/properties of MyFolder from within the methods of MyObject at
>the time of creation. However, after the addition has taken place, I
>can then through the ZMI, access or manipulate those same (and
>previously inaccessible/supposedly-non-existent) properties in
>MyFolder from within MyObj instances.
>
>What am I missing here. Is there anther step besides calling
>_setObject that I need to do, when the container is also a custom
>class in my product? Do I need to define my own __getattr__() for
>MyObj instances? I have tried to grep through the source code for
>various products, but am not seeing an obvious solution.
>
>Thanks,
>Roy Mathew.
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Small Business $15K Web Design Giveaway 
>http://promotions.yahoo.com/design_giveaway/
>
>_______________________________________________
>Zope maillist  -  Zope at zope.org
>http://mail.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists - 
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
>
>  
>




More information about the Zope mailing list