Hello, If a PythonScript is called from a Page Template, how can it access the variables defined using: <tal:define="global ..." /> in the calling script? Of course, one can pass the variables to the PythonScript explicitly as parameters, but is there any other way to let the PythonScript to easily access the name space of its calling page template? Hong Yuan
Hong Yuan wrote:
If a PythonScript is called from a Page Template, how can it access the variables defined using: <tal:define="global ..." /> in the calling script?
Of course, one can pass the variables to the PythonScript explicitly as parameters, but is there any other way to let the PythonScript to easily access the name space of its calling page template?
I very much doubt it. Pass it to the script, which is the right way. --jcc -- "Building Websites with Plone" http://plonebook.packtpub.com
Hong Yuan wrote at 2005-5-27 00:07 +0800:
If a PythonScript is called from a Page Template, how can it access the variables defined using: <tal:define="global ..." /> in the calling script?
It may work to bind the "namespace" binding. Not sure, though... -- Dieter
Hong Yuan wrote:
If a PythonScript is called from a Page Template, how can it access the variables defined using: <tal:define="global ..." /> in the calling script?
no need for the 'global' Go to the Bindings tab of your python script, make sure _ is in the box for "namespace". then, in the python script, you can do: _.getitem('...') cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (4)
-
Chris Withers -
Dieter Maurer -
Hong Yuan -
J Cameron Cooper