[Zope3-Users] Losely or rather, less loosely coupled objects.

Max M maxm at mxm.dk
Thu Mar 9 05:24:58 EST 2006


When doing sites in Zope 2 I often have the need to couple/contain two 
or more fixed objects.

When an object needs to have some specific properites and logic, many 
developers choose to subclass an existing object and change that.

Eg. a member folder needs to *allways* have a 'contact_info' object. Eg. 
to keep company policy and to ease skinning.

That would typically lead to a new folderish content type with contact 
info properties. Which I think is a really bad pattern.


Normally in Zope 2 I just give it a fixed id, and then set the 
folder._reserved_names = ('contact_info',) property on the parent folder.

This is like folder.contacts_info = ContactInfo()

But this is a pretty obscure and unknown feature. And site managers 
cannot use it.


I have the suspicion that many cases where people are doing Archetype 
subclasses in Plone they should really use something like that approach 
instead. It would lead to much simpler maintenance in the long run, with 
a looser coupling of objects and less repetition of functionality.


Are there any good patterns for this in Zope 3? It would be really nice 
to have a standard way of doing it.

It would also be nice if those objects did not show up in the navigation 
like folder contents. It confuses the users that they cannot delete it. 
But rather "outside" the normal navigation. Like in a portlet or as a 
list of actions.

In Plone that is possible by adding a dot to the id like 
'.contact_info', but that is a hack. Also there is no reason to have 
those ugly urls.

Any pointers, or am I the only one thinking along those lines?

-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science

Phone:  +45 66 11 84 94
Mobile: +45 29 93 42 96



More information about the Zope3-users mailing list