Newbie in python script
I would like to know how-to extract results variable from a python script. The python script will extract and parse the string into y, m, d variables. How do I pass these variables into dtml method? TQ Python script ========= parameter = yearmonthdate ymd=string.split(yearmonthday,"/") y=ymd[0] m=ymd[1] d=ymd[2] return y, m, d DTML method ========== <dtml-var expr="splitDate('2003/03/11')">
Check the docs for DTML-LET. -aj --On Freitag, 11. April 2003 12:32 Uhr +0800 CY <cyhoong@pc.jaring.my> wrote:
I would like to know how-to extract results variable from a python script. The python script will extract and parse the string into y, m, d variables. How do I pass these variables into dtml method?
TQ
Python script ========= parameter = yearmonthdate
ymd=string.split(yearmonthday,"/") y=ymd[0] m=ymd[1] d=ymd[2] return y, m, d
DTML method ========== <dtml-var expr="splitDate('2003/03/11')">
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
CY wrote at 2003-4-11 12:32 +0800:
I would like to know how-to extract results variable from a python script. The python script will extract and parse the string into y, m, d variables. How do I pass these variables into dtml method?
TQ
Python script ========= parameter = yearmonthdate
ymd=string.split(yearmonthday,"/") y=ymd[0] m=ymd[1] d=ymd[2] return y, m, d
You return a tuple. You can access the components of a tuple with subscription syntax: "tuple[i]". As Andreas suggested, you can bind values to names with "dtml-let" and reuse them several times. <dtml-let date="splitDate(...)" y="date[0]" m="date[1]" d="date[2]"
.... </dtml-let> It may be easier to return a dictionary and use <dtml-with "splitDate(...)" mapping> <dtml-var y> </dtml-with> Dieter
participants (3)
-
Andreas Jung -
CY -
Dieter Maurer