[Zope] DTML Doc property from DTML Method in tag

Jeff Bauer jeffbauer@bigfoot.com
Mon, 15 Feb 1999 10:11:41 -0600


Kevin Dangoor wrote:
| I'm having trouble getting at an DTML Document property
| from within an in tag in a DTML Method. I have a folder property
| that lists the documents I want to appear in a particular order.
| I would like to display the "title" and "summary" of those documents.
| 
| <!--#in docs-->
| <p><!--#var ???--></p>
| <!--#/in-->

You need to request a list of objects and display their
attributes.  Here's a (slightly hackoid) version of what
I often do.

    <!--#in med_list-->
        <!--#var name--> <!--#var dosage--> <!--#freq--><br>
    <!--#/in-->

---

    def med_list(self):
        """medication list"""
        class _Med:
            def __init__(self, name, dosage, freq):
                self.name = name
                self.dosage = dosage
                self.freq = freq
        medList = []
        for (n, d, f) in self.getMedicationsDosagesFrequencies():
            medList.append(_Med(n,d,f))
        return medList

While were on the subject, however, I was wondering if there
might be a convenient way to pass a list of dictionaries and
use its keys as attributes directly in an <!--#in--> block.

Best regards,

Jeff Bauer
Rubicon, Inc.