[Zope] Implementation Alternatives Question

Stephen Pitts smpitts@midsouth.rr.com
Fri, 28 Jan 2000 02:03:32 +0000


> What I'm currently experimenting with is defining a ZClass for a "Content 
> Viewer" folderish object.  The ZClass would contain definitions for the 
> common methods.  The variability between looks can mostly be accomplished 
> by using different property value settings for each individual ZClass 
> instance.  My current quandary is what to do when a property change isn't 
> sufficient.  If I were doing this in Smalltalk or Java, I would simply 
> subclass my folder viewer and override any methods that I needed.  I know 
> that I can do something similar with ZClasses but I'm wondering if that is 
> a good approach for Zope.

I did just that for two areas of my site. I subclassed Folder and
created a ZClass called ArticleContainer. ArticleContainer has an
index_html method that formats the page like this:
* html_header (imported from site root)
* header (imported from current folder)
* table with articles on left (a tokens property set on a per
  ArticleContainer basis determines which subfolders articles get pulled
  out of)
* sidebars (a list of tokens set on a per ArticleContainer basis; each
  token is looked up and called as a DTML Method to show on the right of
  the table)
  common sidebars are inside of the ArticleContainer ZClass (I'm not
  sure about this), but section-specific ones 
* close table
* footer (imported from current folder)
* html_footer (imported from site root)

perhaps I should merge footer and html_footer, creating a footer that
looks like:
footer commands
<dtml-var "html_footer.__call__(_,_.None)">

(ditto for header). Other than that, though, I like the delegation
stuff.
-- 
Stephen Pitts
smpitts@midsouth.rr.com
webmaster - http://www.mschess.org