[Zope-CMF] Efficient way to get replyCount
Tres Seaver
tseaver@palladion.com
Tue, 25 Sep 2001 09:00:04 -0400 (EDT)
On Tue, 25 Sep 2001, Zopista wrote:
> On the home page of ZopeZen I have a list of articles and want to display
> the reply count for each article. Its there now, but I did it in a hideous
> way, I go and get each message (using restrictedTraverse) and then call
> replyCount on talkback of each object. It works but its hideously expensive.
> Since replyCount isnt exposed anywhere else, I just can see an obvious way
> of doing this quickly, is there one?
You could add 'replyCount' to the metadata schema of your catalog,
and then it would be computed only at indexing time -- you would
want your DiscussionItem skins to cause the source object to be
recatalogued whenever a reply was added, though.
BTW, I really like the way ZopeZen looks and works atop the CMF!
Tres.
--
===============================================================
Tres Seaver tseaver@zope.com
Zope Corporation "Zope Dealers" http://www.zope.com