[Zope] Architectural decisions

Ben Last (Zope) zope at benlast.com
Mon May 24 04:40:59 EDT 2004

Dear Zope list

I'm approaching, on one particular project, a point of architectural
decision.  The site is one of those potentially annoying constructions that
needs to present several different "faces" on the same content, depending on
a set of conditions, in this case:
a) from which partner organisation a user is referred, or by which partner
site the pages are framed
b) whether they're on a web browser or a mobile device
c) in what locale (i.e., country) the user is located
The engineering of all this, in terms of referrers, browser-ids, etc, is all
well-understood, and not a problem.  The decision is more in the
architecture of the page templates.  The question I'm asking myself is, more
or less, which of these approaches do I take?

1) Use monolithic page templates, one per actual page.  To add a new
partner, device or locale, copy existing templates and modify them.  Simpler
templates, but more of them.
2) Use a set of generic templates and share them by acquisition.  More
complex templates, but fewer of them.

In the latter case, there are some interesting techniques that I've
discovered, but also limitations.  Chief amongst the latter is that there
seems to be no way to use a variable as part of a ZPT path.  For example, if
I have, in each partner subfolder, a template called "environment" which
contains statements like:
<span tal:define="global partner HugeInternationalCorporation"/>
...and is referred to by generic scripts with:
<span tal:replace="here/environment | default"/>
...then I can provide each template with a cue to the context in which it's
being invoked.  However, I can see no way to do stuff like:
<h2 tal:content="here/$partner | default">Default Header"</h2>

So, what I'm really interested in are any tips, experiences or general good
advice that can better help me evaluate the pros and cons of approaches 1)
and 2).


More information about the Zope mailing list