merge r46437 and r46946 from davisagli-features: respect the per-comment mime_type setting, and use the old cooked text/html from legacy comments when migrating

svn path=/plone.app.discussion/trunk/; revision=48356
This commit is contained in:
David Glick
2011-04-02 19:51:37 +00:00
parent bf5946367a
commit eb004aab44
11 changed files with 79 additions and 47 deletions
+1 -1
View File
@@ -80,7 +80,7 @@
<div class="commentBody">
<span tal:replace="structure python:view.cook(reply.getText())" />
<span tal:replace="structure reply/getText" />
<div class="commentActions">
<form name="delete"
-11
View File
@@ -271,17 +271,6 @@ class CommentsViewlet(ViewletBase):
# view methods
def cook(self, text):
transforms = getToolByName(self, 'portal_transforms')
targetMimetype = 'text/html'
registry = queryUtility(IRegistry)
settings = registry.forInterface(IDiscussionSettings, check=False)
mimetype = settings.text_transform
return transforms.convertTo(targetMimetype,
text,
context=self,
mimetype=mimetype).getData()
def can_reply(self):
"""Returns true if current user has the 'Reply to item' permission.
"""
+2 -1
View File
@@ -70,7 +70,8 @@ class View(BrowserView):
# create a reply object
comment = CommentFactory()
comment.title = reply.Title()
comment.text = reply.text
comment.text = reply.cooked_text
comment.mime_type = 'text/html'
comment.creator = reply.Creator()
email = reply.getProperty('email', None)
+1 -1
View File
@@ -110,7 +110,7 @@
tal:content="item/in_response_to" />
</td>
<td>
<span tal:replace="structure python:view.cook(item.Description)" />
<span tal:replace="structure item/Description" />
<a href=""
tal:attributes="href string:${item/getURL}/getText"
tal:condition="python:item.Description.endswith('[...]')"
@@ -2,7 +2,6 @@ from Acquisition import aq_inner, aq_parent
from Products.Five.browser import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile
from Products.CMFCore.utils import getToolByName
@@ -37,9 +36,6 @@ class View(BrowserView):
sort_order='reverse')
return self.template()
def cook(self, text):
return text
def moderation_enabled(self):
"""Returns true if a 'review workflow' is enabled on 'Discussion Item'
content type. A 'review workflow' is characterized by implementing