[Zope] ZPT with Zope 3 queries - repeat over contained items;
accessing adapters
Jim Vine
jim_a_vine at yahoo.co.uk
Sun Jul 3 16:30:24 EDT 2005
Hello,
I'm building an application in Zope 3. I have a
container object called a PropertyFolder, which holds
Property objects.
* Repeating over contained items.
I'm trying to create a view which displays a list of
all the Property objects in a property folder. I've
tried doing this as described in the ZPT chapter of
the Zope Book (2.6 edition), using a tal:repeat
statement, but I can't seem to get it working. Has
something changed in Zope 3? I've tried looking in the
Zope 3 book, but none of the references to tal:repeat
in there seem to be used for this type of thing.
* Accessing adapters in ZPT
I've created an adapter that provides a method called
getStars that can be used on Property objects. Can I
access this directly from my ZPT, as I can any other
attribute of a property object? At the moment I've got
it implemented via a Python view class, so my ZPT
accesses it like:
<div class="field" tal:content="view/stars" />
but other attributes can be accessed like:
<div class="field" tal:content="context/description"
/>
so I guess I want to be able to do:
<div class="field" tal:content="context/getStars" />
and negate the need for the Python View Class, which
only says:
def stars(self):
"""Get the stars for the property"""
rate = IPropertyRate(self.context)
stars = rate.getStars()
return stars
Thanks in advance for any tips.
Thanks,
Jim
___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
More information about the Zope
mailing list