Respect the allow_comments field on an object and avoid calculations if no comments should be shown.

svn path=/plone.app.discussion/trunk/; revision=33511
This commit is contained in:
Hanno Schlichting
2010-01-27 17:00:58 +00:00
parent 034d0a93ad
commit 9f4129a65f
3 changed files with 14 additions and 6 deletions
+8 -2
View File
@@ -125,13 +125,19 @@ class Conversation(Traversable, Persistent, Explicit):
obj = aq_parent(self)
# If discussion is disabled for the object, bail out
allow_discussion_flag = getattr(obj, 'allow_discussion', None)
if allow_discussion_flag is False:
return False
# Check if traversal returned a folder with discussion_allowed set
# to True or False.
folder_allow_discussion = traverse_parents(obj)
if folder_allow_discussion == True:
if folder_allow_discussion is True:
if not getattr(self, 'allow_discussion', None):
return True
elif folder_allow_discussion == False:
elif folder_allow_discussion is False:
if getattr(aq_inner(self.__parent__), 'allow_discussion', None):
return True