retain empty text arg in wrap() method

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1933 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2004-11-09 10:28:33 +00:00
parent 6a5fdb57c1
commit 2b60a133ba

View file

@ -54,10 +54,8 @@ def wrap (text, width, **kwargs):
See textwrap.wrap() for a list of supported kwargs.
Returns text with lines no longer than given width.
"""
if width <= 0:
if width <= 0 or not text:
return text
if not text:
return ""
ret = []
for para in get_paragraphs(text):
ret.extend(textwrap.wrap(para.strip(), width, **kwargs))