Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Accept input of None to our transforms.

svn path=/plone.intelligenttext/trunk/; revision=18000
  • Loading branch information...
commit 9d24130d229b64bc6e23671df4280a9cdf5f886e 1 parent 7c08a64
@mauritsvanrees mauritsvanrees authored
View
10 plone/intelligenttext/README.txt
@@ -42,6 +42,11 @@ An email address should be clickable too:
>>> convertWebIntelligentPlainTextToHtml(orig)
'A test <a href="&#0109;ailto&#0058;test&#0064;test.com">test&#0064;test.com</a> of mailto'
+Some basic fallback would be nice:
+
+ >>> convertWebIntelligentPlainTextToHtml(None)
+ ''
+
Text, links and email addressed can be split over multiple lines.
>>> orig = """A test
@@ -114,6 +119,11 @@ this means that tags must be stripped.
>>> convertHtmlToWebIntelligentPlainText(orig)
'Some bold text.'
+Some basic fallback would be nice:
+
+ >>> convertHtmlToWebIntelligentPlainText(None)
+ ''
+
Line breaks need to be handled.
>>> orig = "Some<br/>broken<BR/>text<br />"
View
4 plone/intelligenttext/transforms.py
@@ -27,6 +27,8 @@ def abbreviateUrl(url, max = 60, ellipsis = "[&hellip;]"):
indentRegexp = re.compile(r'^(\s+)', re.M|re.U)
text = orig
+ if text is None:
+ text = ''
if not isinstance(text, unicode):
text = unicode(text, 'utf-8', 'replace')
@@ -90,6 +92,8 @@ def savePres(match):
marker = '__pre_marker__%d__' % (len(preSections),)
preSections[marker] = match.group(1)
return marker
+ if orig is None:
+ orig = ''
text = preRegex.sub(savePres, orig)
# Make whitespace-tag-whitespace into whitespace-tag. Repeat this
Please sign in to comment.
Something went wrong with that request. Please try again.