[Zope] Zope and Polymorphism

Evan Simpson evan@digicool.com
Fri, 11 Feb 2000 22:29:08 -0600


----- Original Message -----
From: Tres Seaver <tseaver@palladion.com>
> > > Or, as an alternative, we could extend the <dtml-in> tag to pass in a
filter
> > > expression as an additional argument::
> > >
> > >   <dtml-in name=objectValues filter="self.hasMetaType( 'Document' )">
> > >
> On further thought, this is better solved by repeating
>
>  <dtml-forever>
>   <dtml-mantra> Separate content from presentation! </dtml-mantra>
>  </dtml-forever>
>
> More seriously, PythonMethods are the Right Thing (TM) here.

I disagree ;-)  Not that PMs aren't good for this; they are, of course.  But
I'd hate to have to write one for something this piddling when the extension
really wouldn't be that bad:

<dtml-in objectValues filter="meta_type == 'DTML Document'">

If the condition was more complex, then I would lean towards encapsulating
it in a PM, and writing:

<dtml-in objectValues filter=LeftHandedWuzzleWidgets>

This allows you some orthogonality between your condition and the sequence
you're applying it to.

> P.S.:  This would be even cooler, except PythonMethods don't have
map/filter
> available:

I'm still not sure why DTML leaves out filter and reduce.  'map' I can sort
of understand, but not the other two.  Put them in DTML, and PMs get them
automatically.

Cheers,

Evan @ digicool