indexers for commentators, number of comments, and latest comment added.
svn path=/plone.app.discussion/trunk/; revision=27766
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user