Fix handling of comments with invalid transforms. Write an error msg to the log and just return the untransformed text.

This commit is contained in:
Timo Stollenwerk
2012-07-12 10:26:39 +02:00
parent 08f11534ea
commit c47689af42
3 changed files with 30 additions and 4 deletions
@@ -177,6 +177,16 @@ class CommentTest(unittest.TestCase):
comment1.text = 'para'
self.assertEqual(comment1.getText(targetMimetype='text/plain'), 'para')
def test_getText_invalid_transformation_raises_error(self):
conversation = IConversation(self.portal.doc1)
comment1 = createObject('plone.Comment')
comment1.mime_type = 'text/x-html-safe'
comment1.text = 'para'
conversation.addComment(comment1)
self.assertEqual(
comment1.getText(targetMimetype='text/html'),
'para')
def test_traversal(self):
# make sure comments are traversable, have an id, absolute_url and
# physical path