I have the following directory structure:
Bugs Interface Insert sendMail - a DTML Document BugsMail getRecipients - a Z SQL Method
I'd like to call and iterate over the results of getRecipients from sendMail. So I tried the following in sendMail:
<dtml-in PARENTS[1].BugsMail.getRecipients> <dtml-var someFieldReturnedByGetRecipients> </dtml-in>
...and I get a KeyError for PARENTS[1].BugsMail.getRecipients....
I tried various other options (albeit somewhat blindly/desparately), eg. putting the whole PARENTS thing in an expression, etc...What am I missing?
What other options are there to traverse a path in a dtml-statement, or to do what I want to do here?
Gerrie, first the long answer: First, PARENTS[1] tells you that it's a python expression (a list), so you have to put it into " 's. So you now would have <dtml-in "PARENTS[1].BugsMail.getRecipients"> <dtml-var someFieldReturnedByGetRecipients> </dtml-in> Because the term is now enclosed in " 's, you're in python and you don't have the magic of dtml-in/var and friends which try to always "do the right thing". You want to call a method in python and you do it that way: <dtml-in "PARENTS[1].BugsMail.getRecipients()"> but now getRecipients doesn't get any parameters handled, you have to pass them explicitly, like <dtml-in "PARENTS[1].BugsMail.getRecipients(myvar=myvar)"> Now the short answer: <dtml-with "PARENTS[1]"> <dtml-with BugsMail> <dtml-in getRecipients> <dtml-var someFieldReturnedByGetRecipients> </dtml-in> </dtml-with> </dtml-with> or alternativly (and even shorter) <dtml-with "PARENTS[1].BugsMail"> <dtml-in getRecipients> <dtml-var someFieldReturnedByGetRecipients> </dtml-in> </dtml-with> cheers, oliver
Please help, I'm pretty new to this...
_______________________________________________ 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 )