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
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
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
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
>>> 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
> 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
- 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:
> >
>
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
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
> > 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
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.
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
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
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
> 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
15 matches
Mail list logo