Fix total_comments indexer

"@property removes Acquisition wrappers from 'self'.
I don't remember why exactly (some implementation detail of Acquisition),
but it's a fact of life."

Quote from @davisagli on
https://github.com/plone/plone.app.discussion/pull/58

In short: removing the @property from total_comments fix the problem.
This commit is contained in:
Gil Forcada 2015-02-16 10:07:02 +01:00
parent 535af3aace
commit d5b5b1c2cd
2 changed files with 1 additions and 2 deletions

View File

@ -33,7 +33,7 @@ def total_comments(object):
if object.meta_type != 'Discussion Item': if object.meta_type != 'Discussion Item':
try: try:
conversation = IConversation(object) conversation = IConversation(object)
return conversation.total_comments return conversation.total_comments()
except TypeError: # pragma: no cover except TypeError: # pragma: no cover
# The item is contentish but nobody # The item is contentish but nobody
# implemented an adapter for it # implemented an adapter for it

View File

@ -77,7 +77,6 @@ class Conversation(Traversable, Persistent, Explicit):
parent = aq_inner(self.__parent__) parent = aq_inner(self.__parent__)
return parent.restrictedTraverse('@@conversation_view').enabled() return parent.restrictedTraverse('@@conversation_view').enabled()
@property
def total_comments(self): def total_comments(self):
public_comments = [ public_comments = [
x for x in self.values() x for x in self.values()