[Zope] Web pages as Object Classes

Johan Carlsson johanc at easypublisher.com
Mon Feb 2 17:44:58 EST 2004

Paolo Losi wrote:
> Johan Carlsson wrote:
>> There are better Design Patterns than inheritance for doing the same 
>> thing. (I am using a dekoration pattern myself where the dekor is a 
>> template with a number of views).
> Is decoration pattern a Carlsson's "trademark" or something "well 
> known"? I couldn't find anything interesting with google...

It might be called something else. I've used Strategy Pattern for a 
while. Implementation wise I only know of EasyPublisher that uses that 
kind of explicit template solution. But ZClasses is similare, but it 
hooks into the Products machinery and are more "programming origented".
ZClasses are global which is a major draw back if you want to have
several different template implemenations in the same server instance.

The general idée is to modify the current namespace to change the 
behavior of an object. ZClasses does it, EP does it, CMF does it,
it's very much Zopish to do it

>> Zope it self uses the concept of run-time inheritance (e.g. acqusition).
>> Your base class would be your root-object, index_html in the root object
>> is the base implementation of render() and it can call header, menu,
>> login_status, content, footer. The sub-classes are object futher down
>> the hieracy and every thing can be overriden in it.
>> The problem with this approach is of course that implementation,
>> data and hierarcy gets mixed up in an unfortunate combination.
> Another problem is that i cannot use parameters with PTL or apply some
> logic to them but... again... I would probably be mixing content and
> presentation again :-)

No, you should leave out the logic from the template.
It's a pain but worth it in the long run.

>> This problem has been taceled in many product, such as portal_skins 
>> (in CMF) or the template system in EasyPublisher or by 
>> proxy/repository implementations.
>> IMHO I think you would be better of understanding the power of Zope
>> first and than look at what archtecture/patterns would suit you.
> You're right. But I feel that trying to understand how to use features
> while you're learning makes you learn faster! :-)

I think so to.
My advice is, get a good grip of acqusition.

>> That's my 25.cents anyway :-)
> You've been very kind and helpful

Good. That's my intent :-)

Johan Carlsson          Tel: + 46 8 31 24 94
Colliberty              Mob: + 46 70 558 25 24
Torsgatan 72            Email: johanc at easypublisher.com
SE-113 37 STOCKHOLM     Skype: colliberty

More information about the Zope mailing list