[Zope] python script returning DTMLMethod problem
Tom Germaine
tgermaine@upei.ca
Wed, 07 Aug 2002 12:06:46 -0300
Hello All:
My earlier question (form/script problem) regarding passing
variables from a form to a python script was successfully solved with
the suggestion by Malik Jablonski to include this in the script:
request = container.REQUEST
myfile=request.myfile
fname=request.fname
Thanks Malik.
But I have a further issue in that I wish the python script to return
a DTMLMethod that calls dtml-tree to display the contents of a
folder. I cannot find any references to python scripts returning
DTMLMethods or Documents and the suggestions following do
not work, I think because of namespace problem.
>>must pass the
>> "positional" parameters.
>> you coded:
> >>>return context.avc.showFiles()
> >should be something like this:
> >return context.avc.showFiles(None,context.REQUEST)
and
>I've had some success with equivalents of
>return context.avc.showFiles(context)
>- then your DTML Method will have a context
>and can find 'avc' in it.
The form, script and DTMLMethod are all in the same folder
object and 'avc' is the container object (folder) for that folder but
the error I get is
Error Type: KeyError
Error Value: avc
Even if I have a single line script calling this DTMLMethod (take
the form out of the loop) I get the same error. Does acquistion
work with python scripts? And can anyone offer a way for a
python script to return DTML methods or documents?
Even if the script:
return context.showUploadRequests()
calling a simple DTML method:
<dtml-var standard_html_header>
<dtml-var REQUEST>
<dtml-var standard_html_footer>
fails with error:
Error Type: KeyError
Error Value: standard_html_header
Tom Germaine