[Zope] Passing variable to a python script

Casey Duncan cduncan@kaivo.com
Mon, 07 May 2001 08:57:11 -0600

Mehmet Yousouf wrote:
> Hi,
> I'm trying out python scripts and can't get the variables posted from a form
> accross.
> I'm calling the script from a dtml method via <dtml-var python-script-name>
> but keep getting "unknown variable" as the error .. it's a simple script that
> adds two numbers together (x = first_number + second_number) and
> first_number, second_number are from the form. The show answer method can
> display both variables (<dtml-var first_number>)
> I'm using python 2 (compiled zope from source) is this the problem? if it is,
> can I run python 2 with pyton 1.52?
> Regards, Mehmet

If you want them to be passed implicitly, bind the namespace to "_" in
the Python script bindings tab and use _['first_number']
_['second_number'] to access them. Or, make REQUEST the sole argument of
the script (it will be passed by zope implicitly) and use
REQUEST.first_number, etc.

| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com