[CMF-checkins] CVS: CMF/CMFDefault - DiscussionTool.py:1.6
Tres Seaver
tseaver@zope.com
Wed, 5 Dec 2001 23:01:40 -0500
Update of /cvs-repository/CMF/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv3235/CMFDefault
Modified Files:
DiscussionTool.py
Log Message:
- Update interface to document new 'overrideDiscussion' API.
- Make the API public, with a permission check, so that non-managers
can call it.
=== CMF/CMFDefault/DiscussionTool.py 1.5 => 1.6 ===
#
- security.declareProtected(CMFCorePermissions.ModifyPortalContent
- , 'overrideDiscussionFor')
+ security.declarePublic( 'overrideDiscussionFor' )
def overrideDiscussionFor(self, content, allowDiscussion):
"""
- Override discussability for a per object basis or clear and let the site default
- override.
+ Override discussability for a per object basis or clear and let
+ the site default override.
"""
+ mtool = getToolByName( self, 'portal_membership' )
+ if not mtool.checkPermission( CMFCorePermissions.ModifyPortalContent
+ , content
+ ):
+ raise "Unauthorized"
+
if allowDiscussion is None or allowDiscussion == 'None':
if hasattr(content, 'allow_discussion'):
del content.allow_discussion
else:
- allowDiscussion = int(allowDiscussion)
- if hasattr(content, 'allow_discussion'):
- content.allow_discussion = allowDiscussion
- else:
- content.manage_addProperty('allow_discussion', allowDiscussion, 'boolean')
+ content.allow_discussion = int(allowDiscussion)
security.declarePublic( 'getDiscussionFor' )
def getDiscussionFor(self, content):