[Zope] Passing parameters using DTML

Paul Winkler pw_lists at slinkp.com
Fri Jun 17 17:07:32 EDT 2005


On Fri, Jun 17, 2005 at 08:24:23PM +0100, John Poltorak wrote:
> Is there also something which explains how to call ZPTs from a DTML 
> object?
>
> I'm unable to pick up a passed parameter.
> 
> This is what I've conjured up:-
> 
> python:here.lib.parse_file(file=context.options['parm'],sepr=',',clone=1)"> 
> 
> hoping that "options['parm']" would get resolved as "ABC" but it doesn't.

John, please, *always* provide tracebacks instead of saying things
like "it doesn't".  

> Any ideas? 

Without a traceback, everything I say below is guesswork.
 
I'm assuming the above line comes from a page template.
You neglected to mention what the calling DTML looks like,
but I *guess* that it was something like this:
<dtml-var "some_template(parm='ABC')">
yes? no?

I am pretty sure that your problem is with the expression
context.options['parm'].  Why do I say this?
Hint 1: Look at that expression from left to right.
Hint 2: Think about what "context.options" means.

In general, if you have not, you really should read the whole of 
http://www.plope.com/Books/2_7Edition/BasicScripting.stx
and  http://www.plope.com/Books/2_7Edition/ScriptingZope.stx
... not just once but several times :-)

Taken together, they answer all "how to call X from Y" questions.

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope mailing list