[Zope] [ZGotW] Issue #7 (Closed)

Tres Seaver tseaver@palladion.com
Wed, 22 Mar 2000 10:21:09 -0600


Evan Simpson wrote:
> 
> ----- Original Message -----
> From: Zope Guru of the Week <ZGotW@palladion.com>
> >  My rationale for adopting this approach, rather than creating
> >  a "folderish" ZClass, was to allow each instance of the "root"
> >  to be independently customized;  the "common" behavior of a
> >  ZGotW site is included in a set of utility methods, which can
> >  be tweaked to enforce different policies, or change the
> >  look-and-feel of a particular site.
> 
> If a "folderish" ZClass had some way to expose its customizable parts, so
> that you could go to an instance and say "instantiate a local copy of method
> foo so I can edit it", would that better fit your intent, here?

The implementation I sketched out a version of the Prototype pattern, I think. 
Exposing the customizable bits is more like a TemplateMethod:  this would play
nicely with Acquisition, perhaps::

  <!-- Inside the index_html method of a "folderish" ZClass -->
  <dtml-if custom_foo>
    <dtml-var custom_foo>
  <dtml-else>
    <dtml-var default_foo>
  </dtml-if>

The trick then becomes giving the manager enough information to know how to
implement 'custom_foo'.  My current hack solves this by cloning the default bit
as a starting point -- perhaps the factory could clone 'default_foo' as
'sample_custom_foo', or something?

-- 
=========================================================
Tres Seaver         tseaver@palladion.com    713-523-6582
Palladion Software  http://www.palladion.com