RE: [Zope] Use of lambda expression in DTML - Result!

2000-05-31 Thread Nick Drew
Thanks for helping me solve this one. In the end I did the following: 1) hacked DocumentTemplate/DT_Util.py to include "filter" in the __builtins__ 2) Installed PythonMethods and called pruneTree with parameter 'self' and content return _.filter( lambda x: x.getProperty('pru

Re: [Zope] Use of lambda expression in DTML

2000-05-30 Thread Chris McDonough
Nick Drew wrote: >> >> |I can see that argument... it depends on the reader, I suppose. I >> |wouldn't complain much actually if the Python code had functional stuff >> |in it. It's having it in DTML that bugs me, for reasons that >> |have to do >> |with separating HTML-like stuff from the stuf

RE: [Zope] Use of lambda expression in DTML

2000-05-30 Thread Nick Drew
Chris McDonough ponders: |> Your method, in particular, is worse to understand than my |> one-liner, specially for anyone who uses functional programming |> seriously; but even other people would have to reason for a |> few minutes to understand what you're appending to that poor |> list and why

Re: [Zope] Use of lambda expression in DTML

2000-05-30 Thread Lalo Martins
On Tue, May 30, 2000 at 10:28:42PM +0200, you wrote: > Minor note: > > "lambda" is not a builtin but part of the syntax (a keyword). > I am sure, they will work in expressions. Uh. Of course that is correct. []s, |alo

Re: [Zope] Use of lambda expression in DTML

2000-05-30 Thread Anthony Baxter
>>> Chris McDonough wrote > Nope. Lamba, filter, reduce, and map should IMHO not be part of DTML. > Actually, exprs probably shouldn't be in there in the first place. > People are trying to use DTML as a way to process non-UI elements. This > is a slippery slope, and leads to something like P

Re: [Zope] Use of lambda expression in DTML

2000-05-30 Thread Duncan Booth
> In brief: I get a NameError when invoking "filter(...)" from DTML. I thought this >was a built-in python method, so I'm a bit puzzled. Python's ideas of 'built-in' is simply any method in the module stored in the global variable called __builtins__. Any code executed with a non-standard glo

Re: [Zope] Use of lambda expression in DTML

2000-05-30 Thread Kevin Dangoor
- Original Message - From: "Lalo Martins" <[EMAIL PROTECTED]> To: <[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: > > >

Re: [Zope] Use of lambda expression in DTML

2000-05-29 Thread Chris McDonough
Lalo Martins wrote: > > 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. OK, I give. I think this would be fine

Re: [Zope] Use of lambda expression in DTML

2000-05-29 Thread Lalo Martins
On Mon, May 29, 2000 at 10:58:54PM -0400, Chris McDonough wrote: > > > > 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 understan

Re: [Zope] Use of lambda expression in DTML

2000-05-29 Thread Chris McDonough
> > What I would like to say is that if your application needs lambda, filter or > > map, your code is getting bejond report or presentation generation (for which > > DTML is intended) and in the realm of data manipulation and business rules. In > > this case your code would be much better placed

Re: [Zope] Use of lambda expression in DTML

2000-05-29 Thread Lalo Martins
On Mon, May 29, 2000 at 09:40:59PM +0200, Martijn Pieters wrote: > > I can't comment with authority on why these methods are not accessible, but I > imagine that they are banned because they'll probably let you lock up Zope in > one way or another, creating a convenient denial-of-service attack.

Re: [Zope] Use of lambda expression in DTML

2000-05-29 Thread Martijn Pieters
On Mon, May 29, 2000 at 04:33:20PM -0300, Lalo Martins wrote: > One big question is: what's wrong with filter, map and lambda? > They can make a lot of code a lot simpler, specially for people > who have a background in functional programming. > > IIRC there is nothing wrong with them - only that

Re: [Zope] Use of lambda expression in DTML

2000-05-29 Thread Lalo Martins
On Fri, May 26, 2000 at 03:05:14PM -0700, Jonothan Farr wrote: > > In brief: I get a NameError when invoking "filter(...)" from DTML. I thought > > this was a built-in python method, so I'm a bit puzzled. > > Certain built-ins are not available in dtml for security and other reasons, > filter an

Re: [Zope] Use of lambda expression in DTML

2000-05-26 Thread Dieter Maurer
Nick Drew writes: > > I'm a newbie zopista, and python for that matter... > > In brief: I get a NameError when invoking "filter(...)" from DTML. I thought this >was a built-in python method, so I'm a bit puzzled. For security reasons, Zope are removed all builtin-functions from DTML expr

Re: [Zope] Use of lambda expression in DTML

2000-05-26 Thread Jonothan Farr
> In brief: I get a NameError when invoking "filter(...)" from DTML. I thought this was a built-in python method, so I'm a bit puzzled. Certain built-ins are not available in dtml for security and other reasons, filter and lambda are among them. As far as I know, you'll need to use an external