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

Last change on this file since 1591 was 89, checked in by chervol, 18 years ago

added i18n in configlet

  • Property svn:eol-style set to native
File size: 1.0 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
8
9class CommentsViewlet(comments.CommentsViewlet):
10    """A custom version of the comments viewlet
11    """
12
13    render = ViewPageTemplateFile('comments.pt')
14
15    def is_moderation_enabled(self):
16        """ Returns a boolean indicating whether the user has enabled moderation
17            in the qPloneComments configlet
18        """
19        portal_properties = getToolByName(self.context, 'portal_properties')
20        try:
21            return portal_properties.qPloneComments.getProperty('enable_moderation', None)
22        except AttributeError:
23            return False
24
25    def can_moderate(self):
26        """ Returns a boolean indicating whether the user has the 'Moderate Discussion'
27            permission
28        """
29        return getSecurityManager().checkPermission('Moderate Discussion', aq_inner(self.context))
Note: See TracBrowser for help on using the repository browser.