[Zope] Passing parameters using DTML

John Poltorak jp at warpix.org
Fri Jun 17 18:25:30 EDT 2005


On Fri, Jun 17, 2005 at 05:07:32PM -0400, Paul Winkler wrote:
> 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?

This is what I have:-

<dtml-var expr="testlist(parm='myobjectname')">

I wish to get 'myobjectname' into this line in 'testlist' which is marked
with *********

python:here.parse_file(file=context.******,sepr=',',clone=1)"> 

There must be a simple way of doing this, but I haven't come across an 
example of it and I've spent most of the day on it.
 
> 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 :-)

There is too much to read and understand. Much of it only ever makes any 
sense in retrospect. Manuals are not a very useful way of learning how to 
do something

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

I'm sure they do, if you can make any sense of it. 
 
> -- 
> 
> Paul Winkler
> http://www.slinkp.com


-- 
John




More information about the Zope mailing list