dtml-set (c) Ivo van der Wijk, Amaze Internet Services ([email protected])
What does it do? ----------------
This product implements a tag that enables dtml coders to set variables transparently. It basically replaces those ugly (and error prone) calls.
It also provides an optional tag, which will only do the assignment if the target variable previously didn't exist, previously equivalent to:
optional
Why not dtml-let? -----------------
dtml-let requires a block, which can be usefull to keep the changed namespace local and clean, but it makes it really hard to make a variable available in your entire dtml document/method.
Why not dtml-eval? ------------------
dtml-eval (another similar external product) requires a block structure. Assignments within this blockstructure are global within your dtml document/ method, but I like the shorter dtml-set notation. Also, it lacks the optional tag.
Examples --------
(assigns previously set j to q)
(only assings if name was undefined)
(will print 25)
Pitfalls ---------
Assigning a string has to be done using a python expression, which has to be enclosed in "", i.e.
dtml-set is not limited by the scope of other tags, i.e.
Will work fine.
TODO list ---------