Thanks for the links, i had read the DevGuide when i began with Zope, but found it esoteric at that time. My knowledge evolving, it's easier to read What i understood, Containment: the objects' house and the path to the object from the root context: the road used to reach the object. A property will be searched first in the object's containment, then in its parents ones, to the root. If the containment-search failed, the search will be made in the context. The context may be searched by using basic acquisition or by calling methods on wrappers (aq_inner, aq_chain, aq_parent, _of_, etc. . My example company will be a mix of containment and context design. Company/ Headquarters/ Subsidiary 1/ | to n /(HQ and Sub will be called departments) Products/ - Items Property 'related_to' (the HQ or a Sub) Property 'belongs_to' (the id of HQ or the Sub which sells the product) Proposals/ - Items Property 'related_to' (the HQ or a Sub) Property 'belongs_to' (the id of HQ or the Sub editing the proposal) - addMethod - listMethod When i want to add a product or a Proposal i use : Company/<Department_id>/<Products_or_Proposals/addMethod : the object will inherit of the department properties but will be stored in <Products_or_Proposals> that will be the context. Departements will be one of the aq_parent of the object. When i want to list all Products or Proposals i use Company/Products_or_Proposals/listMethod for a specific Subsidiary i use Company/<department_id>/Products_or_Proposals/listMethod as i need to have the sub's specific Products + the HQ's Products, i test the 'related_to' and 'belongs_to' properties. Not too stupid ? Andre Dylan Reinhardt a écrit:
One quick correction...
At 06:51 AM 1/29/2003, D2 wrote:
in context._setObject() context *is* containment ?
I didn't read this question correctly before and gave an unhelpful answer. The context object contains, among other things, a reference to your current container object.
Using container-related methods on context (the object) has the effect of applying them to a specific container object... which container object that is will be determined by context (as in the environment, not the context object).
Using container methods on the context object allows you to generalize your code, but it's the same thing as if you hard-coded a folder name and applied the same methods to it: any objects you create using this technique will have a containment relationship with a specific container. Which container that is can be determined by context if you wish.
Sorry if that's pretty jargon-dense... it's a trickier question than I realized at first.
Dylan
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )