[Zope] Organisational vs. Functional hierarchies

bruno modulix bruno at modulix.org
Wed Apr 20 04:48:36 EDT 2005


David Given wrote:
> On Tue, 2005-04-19 at 18:43 +0200, bruno modulix wrote:
> [...]
> 
>>>All of B's siblings are the same sort of object.
>>
>>Why do you have this strange idea ?
> 
> 
> From, uh, the documentation... because all of B's siblings will inherit
> the same methods from A.

s/inherit/acquire/

> [...]
> 
>>Then calls like:
>>Rose/Text/MyFavouriteRoseStories/text_methods/do_this
> 
> 
> Ah, so *that's* how acquisition by context works! (I couldn't find any
> documentation on this. All the documentation about acquisition by
> context just says 'this is really complicated and I'm not going to
> describe it here'.)

It *is* really complicated, and I'd advise you not to go for this 
solution. What you want is clearly a Product.

> 
>>2/ Write a product for your object types. Here it could be a Flower 
>>object, extending Folder so you can put texts and images in, and having 
>>all the code needed for your texts and images.
>  
> Unfortunately, this requires having the code dealing with text and
> images to be in the same place, which breaks encapsulation.

Why ? What you want is a custom "Flower" object, that can handle texts 
and images, right ? But if this bother you too much, you can add to your 
product specific texts and images classes (remember, a product is a 
componant, not a class - it can be composed of multiple classes, 
templates, images, external methods etc).

(snip)
> Meh. Can you point me at any good tutorial documentations?
> 

google for zope + "minimal product". Also read the developper's book on 
zope.org. And read the code of a few products. That's how I did anyway.


-- 
Bruno Desthuilliers
Développeur
bruno at modulix.org


More information about the Zope mailing list