source: products/qPloneComments/tags/3.0.2/browser/comments.py @ 1591

Last change on this file since 1591 was 1, checked in by myroslav, 18 years ago

Building directory structure

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1from Acquisition import aq_inner
2from AccessControl import getSecurityManager
3from Products.CMFPlone.utils import getToolByName
4
5from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
6from plone.app.layout.viewlets import comments
7
8class CommentsViewlet(comments.CommentsViewlet):
9    """A custom version of the comments viewlet
10    """
11
12    render = ViewPageTemplateFile('comments.pt')
13   
14    def is_moderation_enabled(self):
15        """ Returns a boolean indicating whether the user has enabled moderation
16            in the qPloneComments configlet
17        """
18        portal_properties = getToolByName(self.context, 'portal_properties')
19        try:
20            return portal_properties.qPloneComments.getProperty('enable_moderation', None)
21        except AttributeError:
22            return False
23       
24    def can_moderate(self):
25        """ Returns a boolean indicating whether the user has the 'Moderate Discussion'
26            permission
27        """
28        return getSecurityManager().checkPermission('Moderate Discussion', aq_inner(self.context))
Note: See TracBrowser for help on using the repository browser.