Kenneth Gonsalves schrieb:
On Monday 20 Jun 2005 5:26 pm, Tonico Strasser wrote:

Kenneth Gonsalves schrieb:

i am having a very weird experience. I have a page template
called manageheads. This requires a parameter called
'companyname' to be passed to it. I access this option as:
when i call the ZPT from the web like so:
it works

Are you shure this works? Did you redefine 'options' somewhere?

but if i call it from a python script like so:
return manageheads(companyname=nameofcompany)
it complains saying
key error 'companyname'

It should simply work.

The weird thing is that i have several similar ZPTs where this
call from python scripts work perfectly in the same zope
instance. So why not in this one? any clues?

Maybe you did redefine 'options' in your template.

options has not been redefined anywhere. The problem appears to be in the way to call a particular python script

this is a bit long, but interesting nevertheless -:)

the variable in question is 'compname' which is either request['compname'] or options['compname'] depending on how the ZPT is called (from web it goes to 'request' and from script in goes to 'options')

This is the script:
parameter list: compname

for k in theads:
for k in htree:
return headtree

when tested using the test tab it works
when the originating ZPT is called from the web using '?' notation it works
when called from the following script:
return names

it gives a Keyerror 'compname'

when the originating ZPT is called from a script:

it gives a Keyerror 'compname'

Ok, you've got a KeyError, but where? Traceback?


ZPT mailing list

Reply via email to