[ZPT] Namespaces and calling PythonScript from ZPT

Evan Simpson evan@zope.com
Mon, 04 Mar 2002 15:43:25 -0500


Chris Withers wrote:
 > If have something like:
 >
 > <td tal:define="mything some_script_or_something"
 > tal:content="here/myPythonScript"> </td>
 >
 > ...how can I get hold of mything inside myPythonScript other than
 > doing the horrible nasty:
 >
 > <td tal:define="mything some_script_or_something" tal:content="python:
 > here.myPythonScript(mything=mything)"> </td>

If you bind the namespace to something ("ns", for example) on the
Script's Bindings tab, then the calling ZPT's name stack will get bound 
to that name, and you can write:

ns['mything']

Cheers,

Evan @ Zope