fix for "TypeError: can't pickle OIBTreeItems objects".

svn path=/plone.app.discussion/trunk/; revision=27778
This commit is contained in:
Timo Stollenwerk 2009-07-02 17:50:20 +00:00
parent d7bbee3a99
commit 41010fb32a
3 changed files with 8 additions and 2 deletions

View File

@ -36,7 +36,7 @@ def last_comment_date(object):
@indexer(IContentish, IZCatalog)
def commentators(object):
conversation = IConversation(object)
return conversation.commentators
return tuple(set(conversation.commentators.keys()))
# Comment Indexers

View File

@ -167,7 +167,7 @@ class Conversation(Traversable, Persistent, Explicit):
@property
def commentators(self):
return self._commentators.keys()
return self._commentators
def objectIds(self):
return self._comments.keys()
@ -255,6 +255,10 @@ class Conversation(Traversable, Persistent, Explicit):
notify(ObjectAddedEvent(comment.__of__(self), self, id))
notify(ContainerModifiedEvent(self))
# XXX: This shouldn't be necessary.
content_obj = aq_parent(self)
content_obj.reindexObject()
return id
# Dict API

View File

@ -422,6 +422,8 @@ class ConversationTest(PloneTestCase):
# object, as we just want to check the Conversation object API.
conversation = IConversation(self.portal.doc1)
self.assertEquals(conversation.total_comments, 0)
# Add a four comments from three different users
# Note: in real life, we always create
# comments via the factory to allow different factories to be