[Zope] Passing parameters to python script objects

Uwe Fechner uwe.fechner@4commerce.de
Mon, 23 Apr 2001 18:59:58 +0200


Hello everyone,

I'm a newbee with zope and have the following problem:

I want to display calculated results from an SQL-Database.

I created an object 'Script (Python)' that looks like:

## Script (Python) "myFunction"

## bind container=3Dcontainer
## bind context=3Dcontext
## bind namespace=3D_
## bind script=3Dscript
## bind subpath=3Dtraverse_subpath
## parameters=3DmyParam
## title=3DmyFunction
##

return myParam[0:-1]

Then I created a dtml document object with the content:

<dtml-var expr=3D"myFunction('test')">

If I choose 'View' I see:

tes

This is what I have expected (the function chops the last charact=
er).

Then i tried:

<dtml-in select_all_from_myTable>
   <p><dtml-var myField1></p>
</dtml-in>=20

If i choose 'View' i see:

test1
test2
test3

Then I tried:

<dtml-in select_all_from_myTable>
   <p><dtml-var expr=3D"myFunction(<dtml-var myField1>)"></p>
</dtml-in>=20

If I choose 'View' I get:

Expression (Python) Syntax error:=20
invalid syntax

So, how do i have to write this call, that it chops the last
character of myField1 ?

Best regards:

Uwe Fechner