[Zope] parsing strings in DTML

Jeff K. Hoffman jeff.hoffman@goingv.com
Mon, 26 Jun 2000 17:21:47 -0400 (EDT)


On Mon, 26 Jun 2000, Timothy Wilson wrote:

> On Mon, 26 Jun 2000, Rik Hoekstra wrote:
> 
> > try something like (untested):
> > 
> > <dtml-call "REQUEST.set('parse_address', _string.split(old_address, '$')">
> > 
> > for parsing the string
> 
> But what if "parse_address" comes from a SQL query? Like this:
> 
> <dtml-in qry_contactInfo>
>   <dtml-call "REQUEST.set(<dtml-var parse_address>, ... etc.
> 
> Don't I run into trouble with nested DTML here?

You should never "nest" DTML like you are suggesting. It won't work.

Variables set through REQUEST.set are immediately accessable in DTML
expressions after it, i.e.:

  <dtml-call expr="REQUEST.set('i', 0)">
  <dtml-var i>
  <dtml-call expr="REQUEST.set('i', i + 1)">
  <dtml-var i>

Notice all I did was "i + 1", not "<dtml-var i> + 1". You simply reference
it, as you would in python.

> -Tim

--Jeff

---
Jeff K. Hoffman                               704.849.0731 x108
Chief Technology Officer                      mailto:jeff.hoffman@goingv.com
Going Virtual, L.L.C.                         http://www.goingv.com/