----- Original Message -----
From: "Lalo Martins" <[EMAIL PROTECTED]>
Sent: Monday, May 29, 2000 11:40 PM
Subject: Re: [Zope] Use of lambda expression in DTML

> On Mon, May 29, 2000 at 10:58:54PM -0400, Chris McDonough wrote:
> >
> > > <dtml-in "_.map (lambda item: Catalog.getobject
> > >         Catalog (REQUEST)">
> >
> >
> > How could someone understand this when you're finished with it?
> Perfectly clearly for anyone used to functional programming;
> I'd even say, clear on first sight. A lot easier to understand
> and maintain than a separate method.

Assuming I'm reading this correctly, I think I'd probably express this as:

<dtml-in "Catalog(REQUEST)">
  <dtml-with "Catalog.getobject(data_record_id_)">

BTW, I agree that exprs should be a part of DTML. You don't want to put
significant program logic in DTML, but there are many places in which exprs
are useful:

Total: <dtml-var "subtotal + shipping">

I'll grant that you can set up all of the variables you need via a
PythonMethod beforehand, but things like this can be nice and convenient...

Any power that can be given to PythonMethods securely is a boon.


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to