[Zope] Zope pdf's on the fly

J Cameron Cooper jccooper@jcameroncooper.com
Mon, 07 Jul 2003 12:53:06 -0500


>
>
>If I use a form to set up parameters to the external method and 
>
>	<form action="doit.pdf()">
>	..
>	</form>
>
>it works fine.  Of course, 
>
>	<dtml-var expr="doit.pdf()">
>
>doesn't.
>  
>
One of the problems that let to the "path syntax" of TALES. As such, 
this is one of the old, bad, Zopisms I'm about to explain.

If you want to call something with dots in it in Python syntax, you have 
to look it up in the namespace dictionary. The namespace dictionary is 
mysteriously named '_'. No, that's not a crappy emoticon, it's an 
underscore, in quotes (which is the STX code markup.) And you have to 
use strings to look up a name in a dictionary. So the lookup looks like::

_['nameofthing']

Also available is 'getitem' on the namespace variable, if that seems 
less insane::

_.getitem('nomeofthing')

So your code, in DTML, will look like::

<dtml-var expr="_['doit.pdf']">

          --jcc