[Zope] Passing parameters to python script objects

Peter Sabaini sabaini@niil.at
Mon, 23 Apr 2001 19:36:57 +0200 (CEST)


Hi,

inside an expr you cannot use DTML anymore. Everything inside "" is a
kind of Python parallel universe ;)

So, you'd just use something like (untested):

<dtml-in ...>
  <dtml-var expr="myFunction(myField1)">
....

ru,
peter.

On Mon, 23 Apr 2001, Uwe Fechner wrote:

> 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=container
> ## bind context=context
> ## bind namespace=_
> ## bind script=script
> ## bind subpath=traverse_subpath
> ## parameters=myParam
> ## title=myFunction
> ##
>
> return myParam[0:-1]
>
> Then I created a dtml document object with the content:
>
> <dtml-var expr="myFunction('test')">
>
> If I choose 'View' I see:
>
> tes
>
> This is what I have expected (the function chops the last character).
>
> Then i tried:
>
> <dtml-in select_all_from_myTable>
>    <p><dtml-var myField1></p>
> </dtml-in>
>
> If i choose 'View' i see:
>
> test1
> test2
> test3
>
> Then I tried:
>
> <dtml-in select_all_from_myTable>
>    <p><dtml-var expr="myFunction(<dtml-var myField1>)"></p>
> </dtml-in>
>
> If I choose 'View' I get:
>
> Expression (Python) Syntax error:
> invalid syntax
>
> So, how do i have to write this call, that it chops the last
> character of myField1 ?
>
> Best regards:
>
> Uwe Fechner
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>

-- 

_________________________________________________
peter sabaini, mailto: sabaini@niil.at
-------------------------------------------------