[Zope-dev] Using DTML is too difficult

Evan Simpson evan@4-am.com
Wed, 10 Nov 1999 22:59:18 +0000


Itamar Shtull-Trauring wrote:

> Not to mention the ability to do some really cool stuff with ZCatalogs (find
> all items beginning with the letter 'A', searching using metaphone or
> soundex [I did this, if anyon'es interested], etc.)  I can't figure how to
> do the <dtml-with> tag in python, though.

For some uses (such as <dtml-with "_(x=3, ...)">), you can substitute local
variables.  For example, something like

<dtml-with "ick.arg.blah">
  <dtml-var thingy>
  <dtml-call amethod>
</dtml-with>

could become

it = ick.arg.blah
print it.thingy
it.amethod()

Pushing namespaces onto the stack for the use of called methods is quite
another matter.  You would need code like

try:
  _._push(ick.arg.blah)
  ...
finally:
  _.pop()

and of course this won't work since _push and _pop are private methods.  Even
if they were properly exposed, I'm not sure how this could be made pretty.

Cheers,

Evan @ 4-am