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
On Mon, Apr 23, 2001 at 06:59:58PM +0200, Uwe Fechner wrote:
Then I tried:
<dtml-in select_all_from_myTable> <p><dtml-var expr="myFunction(<dtml-var myField1>)"></p> </dtml-in>
You fell for the old "nested dtml" trap. Try: <p><dtml-var "myFunction(myField1)"></p> As you've discovered, you can't nest dtml statiments in other dtml statments. -- Patrick Lewis <plewis@inetarena.com>
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 -------------------------------------------------
participants (3)
-
Patrick Lewis -
Peter Sabaini -
Uwe Fechner