[Zope] need to get item from string in Python Script
Chris Withers
chrisw@nipltd.com
Wed, 07 Feb 2001 09:45:27 +0000
"Farrell, Troy" wrote:
>
> Can someone tell me how to do the equivalent of <dtml-var
> "_.getitem(REQUEST['variablenameinastring'])"> in PythonScript
Go to the bindings tab and bind the namespace to _.
(Not sure why this wasn't done by default :-S)
Then just do:
_.getitem(context.REQUEST['variablenameinastring'])
I wonder why REQUEST isn't one of the things you can bind.
Or RESPONSE for that matter :-S
cheers,
Chris
PS: answer to own question: put REQUEST and RESPONSE in the parameter list :-)
(If you do that, you don't need to 'context.' before the REQUEST above...)