[Zope] - Looping over the characters in a string in DTML...

Ty Sarna tsarna@endicor.com
Sat, 16 Jan 1999 11:36:23 -0600 (CST)


Janko Hauser wrote:
> I would vote against this. DTML is AFAIK focused towards separation of 
> scripting from HTML. If you need the reuslts of these function calls 
> why not use an external method. This was more natural in BOBO (no need 
[...]
> DTML functions should be there for easier formatting of HTML but not
> to build complex program logic into a HTML file.

I don't see this at all -- DTML has tags like #in just so that complex
program logic can be put into a document template.  (At least, if you
define a loop as "complex logic")

Python is somewhat unusual among programming languages in not having a
control contruct for a counting loop.  BASIC, Pascal, FORTH, and
PostScript have constructs for just that task.  C and distantly related
languages like Tcl and Perl have a more general "for" construct, but
still clearly designed with counting loops in mind.  They all provide
these features because it's such a common task.  The only reason Python
gets away with not having that kind of construct is that it provides
range() as a builtin.

On a more practical note, producing a picklist of years given a
start and end date seems like a fairly common thing to want do.  Why
should I have have to give a content author on my zope site access to
the filesystem, just to write a one-line function wrapper around a
builtin python function?