def comment_count(self, obj): """ Returns the number of comments for the given object or False if comments are disabled. """ if HAS_PAD: if IDiscussionLayer.providedBy(self.request): conversation = IConversation(obj) return conversation.enabled() and len(conversation) if self.context.portal_discussion.isDiscussionAllowedFor(obj): discussion = self.context.portal_discussion.getDiscussionFor(obj) return discussion.replyCount(obj) return False
def comment_count(self, obj): """ Returns the number of comments for the given object or False if comments are disabled. """ if HAS_PAD: if IDiscussionLayer.providedBy(self.request): conversation = IConversation(obj) return conversation.enabled() and len(conversation) if self.context.portal_discussion.isDiscussionAllowedFor(obj): discussion = self.context.portal_discussion.getDiscussionFor(obj) return discussion.replyCount(obj) return False
def comment_count(self, obj): """ Returns the number of comments for the given object or False if comments are disabled. """ discussion_allowed = self.portal_discussion.isDiscussionAllowedFor(obj) if not HAS_PAD and not discussion_allowed: return False if not HAS_PAD and self.portal_discussion.isDiscussionAllowedFor(obj): discussion = self.portal_discussion.getDiscussionFor(obj) return discussion.replyCount(obj) # HAS_PAD == True if IDiscussionLayer.providedBy(self.request): conversation = IConversation(obj) if conversation.enabled(): workflow = getToolByName(self.context, "portal_workflow") cvalues = conversation.values() return len([c for c in cvalues if workflow.getInfoFor(c, "review_state") == "published"])
def comment_count(self, obj): """ Returns the number of comments for the given object or False if comments are disabled. """ discussion_allowed = self.portal_discussion.isDiscussionAllowedFor(obj) if not HAS_PAD and not discussion_allowed: return False if not HAS_PAD and self.portal_discussion.isDiscussionAllowedFor(obj): discussion = self.portal_discussion.getDiscussionFor(obj) return discussion.replyCount(obj) #HAS_PAD == True if IDiscussionLayer.providedBy(self.request): conversation = IConversation(obj) if conversation.enabled(): workflow = getToolByName(self.context, 'portal_workflow') cvalues = conversation.values() return len([c for c in cvalues \ if workflow.getInfoFor(c, 'review_state') == 'published'])
def commentsEnabled(self, ob): conversation = IConversation(ob) return conversation.enabled()
def commentsEnabled(self, ob): if USE_PAD: conversation = IConversation(ob) return conversation.enabled() else: return self.portal_discussion.isDiscussionAllowedFor(ob)
def is_discussion_allowed(self): context = aq_inner(self.context) conversation = IConversation(context) super_enabled = conversation.enabled() return super_enabled and self._activated()
def commentsEnabled(self, ob): if USE_PAD: conversation = IConversation(ob) return conversation.enabled() else: return self.portal_discussion.isDiscussionAllowedFor(ob)
def is_discussion_allowed(self): context = aq_inner(self.context) conversation = IConversation(context) super_enabled = conversation.enabled() return super_enabled and self._activated()
def is_discussion_allowed(self): return True context = aq_inner(self.context) conversation = IConversation(context) return conversation.enabled()
def commentsEnabled(self, ob): conversation = IConversation(ob) return conversation.enabled()