[Zope] Zope Patterns
Douwe Osinga
dmo at oberon.nl
Thu Jan 15 07:52:22 EST 2004
Hi Zopers,
I have a musing about how Zope sites are set-up which I would like to share
and would very much like comments on.
Typically, a web page has a header, a body and a footer. In most Zope
instances, this is translated into standard_html_header,
standard_html_footer, while an index_html calls these and does something
interesting in between.
I don't like this setup too much, because it explicitly repeats the calling
of standard_html_* for every page. If you want to add a parameter to for
example standard_html_header (say the css to use or similar), you'll have to
change all pages (yes, you can use default parameters, but that is not the
point). So I usually end up with a structure like this:
root
index_html
standard_html_footer
standard_html_header
mainbody
folder1
mainbody
folder2
mainbody
where index_html calls header, mainbody and footer. This works great, except
for that you need a folder for any page that needs to display the structure.
If you want add a method to the root folder that is applicable to everypage,
then this method needs to call the structure again.
One could of course create a method that takes as a parameter the contents
(mainbody) of a page and than calls the structure methods, but that works
clumsy too.
I have been thinking in subclassing python script in a way that it calls
index_html and inserts the result of the script in the position of the call
to mainbody.
Do other people recognize this pattern? Other solutions?
I'd love to hear.
Douwe Osinga
http://douweosinga.com
More information about the Zope
mailing list