Back to index

plone3  3.1.7
DiscussionTool.py
Go to the documentation of this file.
00001 from Products.CMFDefault.DiscussionTool import DiscussionTool as BaseTool
00002 from Products.CMFPlone import ToolNames
00003 from AccessControl import ClassSecurityInfo
00004 from Globals import InitializeClass
00005 from Products.CMFPlone.PloneBaseTool import PloneBaseTool
00006 from Products.CMFDefault.permissions import ReplyToItem
00007 
00008 from StructuredText.StructuredText import HTML
00009 from DocumentTemplate.DT_Util import html_quote
00010 
00011 from Acquisition import aq_base
00012 from Products.CMFCore.interfaces.Discussions \
00013         import DiscussionResponse as IDiscussionResponse
00014 
00015 from plone.intelligenttext.transforms import convertWebIntelligentPlainTextToHtml
00016 
00017 class DiscussionTool(PloneBaseTool, BaseTool):
00018 
00019     meta_type = ToolNames.DiscussionTool
00020     security = ClassSecurityInfo()
00021     toolicon = 'skins/plone_images/discussionitem_icon.gif'
00022 
00023     __implements__ = (PloneBaseTool.__implements__, BaseTool.__implements__, )
00024 
00025     security.declareProtected(ReplyToItem, 'cookReply')
00026     def cookReply(self, reply, text_format=None):
00027         """ TODO We need this because currently we can not easily change the
00028             text_format on document objects.  Discussions in plone are going
00029             to use plain-text for now.  stx is too confusing.
00030         """
00031         reply.cooked_text = convertWebIntelligentPlainTextToHtml(reply.text)                                    
00032 
00033 DiscussionTool.__doc__ = BaseTool.__doc__
00034 
00035 InitializeClass(DiscussionTool)