Do not raise an error if the comment text is None.

This commit is contained in:
Timo Stollenwerk 2011-11-30 13:05:59 +01:00
parent ead76ee406
commit 6a7c89ec78
2 changed files with 4 additions and 1 deletions

View File

@ -4,7 +4,8 @@ Changelog
2.1.2 (unreleased) 2.1.2 (unreleased)
------------------ ------------------
- nothing. - Do not raise an error if the comment text is None.
[timo]
2.1.1 (2011-11-24) 2.1.1 (2011-11-24)

View File

@ -138,6 +138,8 @@ class Comment(CatalogAware, WorkflowAware, DynamicType, Traversable,
settings = registry.forInterface(IDiscussionSettings, check=False) settings = registry.forInterface(IDiscussionSettings, check=False)
sourceMimetype = settings.text_transform sourceMimetype = settings.text_transform
text = self.text text = self.text
if text is None:
return ''
if isinstance(text, unicode): if isinstance(text, unicode):
text = text.encode('utf8') text = text.encode('utf8')
return transforms.convertTo(targetMimetype, return transforms.convertTo(targetMimetype,