[Zope] dtml question: xrange?

Martijn Pieters mj@antraciet.nl
Mon, 19 Jul 1999 15:16:10 +0200


At 14:51 19/07/99 , Paul Everitt wrote:

>I see that Alexander answered the question, so I'll provide the answer
>to "Why not?"
>
>Zope tries to prevent people from resource attacks via TTW editing.  One
>way that Jim Fulton worked pretty hard on was preventing people from
>creating huge sequences, such as with the range function(s).
>
>--Paul

That's why I wrote an example of an External Method that does a check on 
the length of the range, which has subsequently been turned into an 
addition to Zope 2. In Zope 2 you can do:
  <dtml-in "_.range(0, number_of_times)">
     <!--Do your worst-->
  </dtml-in>

The _.range method does everything the bog standard python range() does, 
but won't let you make a range that contained more that 999 elements (like 
range(0, 20000, 3)).

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------