Skip to content

Commit

Permalink
Return str in Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli authored and pbauer committed Oct 5, 2018
1 parent 7ae5447 commit f8630f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ New features:

Bug fixes:

- *add item here*
- Return str from transform in Python 3.
[davisagli]


2.2.1 (2018-01-17)
Expand Down
2 changes: 1 addition & 1 deletion plone/intelligenttext/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Indentation should be preserved::
... URL: http://foo.com"""
>>> bprint(convertWebIntelligentPlainTextToHtml(orig))
A test<br />&nbsp;&nbsp;URL: <a href="http://test.com" rel="nofollow">http://test.com</a><br />&nbsp;&nbsp;&nbsp;&nbsp;Mail: <a href="&#0109;ailto&#0058;test&#0064;test.com">test&#0064;test.com</a><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;URL: <a href="http://foo.com" rel="nofollow">http://foo.com</a>
>>> convertWebIntelligentPlainTextToHtml(orig).count(b'&nbsp;')
>>> convertWebIntelligentPlainTextToHtml(orig).count('&nbsp;')
12

HTML entities should be escaped::
Expand Down
3 changes: 2 additions & 1 deletion plone/intelligenttext/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def __call__(self):
# Finally, make \n's into br's
text = text.replace('\n', '<br />')

text = text.encode('utf-8')
if not PY3:
text = text.encode('utf-8')

return text

Expand Down

0 comments on commit f8630f8

Please sign in to comment.