indexers for commentators, number of comments, and latest comment added.

svn path=/plone.app.discussion/trunk/; revision=27766
This commit is contained in:
Timo Stollenwerk
2009-07-01 20:57:55 +00:00
parent 9e94afc072
commit 6647439971
5 changed files with 240 additions and 4 deletions
+27 -1
View File
@@ -8,12 +8,38 @@ from string import split, join
from DateTime import DateTime
from Products.CMFCore.interfaces import IContentish
from Products.ZCatalog.interfaces import IZCatalog
from plone.indexer import indexer
from plone.app.discussion.interfaces import IComment
from plone.app.discussion.interfaces import IConversation, IComment
MAX_DESCRIPTION=25
# Conversation Indexers
from plone.indexer.interfaces import IIndexer
@indexer(IContentish, IZCatalog)
def total_comments(object):
conversation = IConversation(object)
return conversation.total_comments
@indexer(IContentish, IZCatalog)
def last_comment_date(object):
conversation = IConversation(object)
return conversation.last_comment_date
@indexer(IContentish, IZCatalog)
def commentators(object):
conversation = IConversation(object)
return conversation.commentators
# Comment Indexers
@indexer(IComment)
def title(object):
return object.title