[ZPT] How do I...

Tony McDonald tony.mcdonald@ncl.ac.uk
Thu, 17 May 2001 13:41:38 +0100


On 17/5/01 8:38 am, "Tony McDonald" <tony.mcdonald@ncl.ac.uk> wrote:


>> 
>>> 2) I'd also like to call the above PageTemplate from DTML, substituting the
>>> module_code='bgm' above with module_code=modcode, and pass modcode into the
>>> PageTemplate. I'm using this code;
>>> 
>>> tal:repeat="item python:container.module_info(module_code=request/modcode)"
>>> 
>>> Unfortunately the standard idiom
>>> 
>>> <dtml-var "mod_info(_.None,_,modcode='bgm')">
>>> 
>>> Returns an error:
>>> Error Type: TALESError
>>> Error Value: exceptions.NameError on modcode in ""

>> [richard]
>> 
>> You'd be wanting to use "module_code=options/modcode" in the TAL.
>> 
> 
> Just tried that, and still get the
> <strong>Error Type: TALESError</strong><br>
> <strong>Error Value: exceptions.NameError on modcode in "<PythonExpr
> container.module_info(module_code=options/modcode)>"</strong><br>
> 
> error.
> 
> I've also tried passing the variable in from the browser window, ie
> mod_info?modcode=bgm
> And get the same response.
> 

To get this to work, I had to do
 tal:repeat="item 
python:container.module_info(module_code=options['modcode'])"

A side effect of which was that I could then do

<dtml-var "mod_info(modcode='bgm')">

happily.

Thing is, I can no longer use the mod_info?modcode=eng structure from the
browser window. The variable doesn't exist in the options namespace, only in
the form namespace.

I would have thought that the options/modcode structure that Richard
mentioned is more in line with the thinking behind TAL? (I could be way off
- like I said, I'm coming from DTML-land).

Cheers
Tone.
-- 
Dr Tony McDonald,  Assistant Director, FMCC, http://www.fmcc.org.uk/
The Medical School, Newcastle University Tel: +44 191 243 6140
A Zope list for UK HE/FE  http://www.fmcc.org.uk/mailman/listinfo/zope