tools.web: don't try to striphtml content that is not str or buffer

This commit is contained in:
nemunaire 2015-09-15 20:15:35 +02:00
parent 9b2bc27374
commit 760da8ef61

View File

@ -208,6 +208,9 @@ def striphtml(data):
data -- the string to strip
"""
if data is None or (not isinstance(data, str) and not isinstance(data, buffer)):
return data
import re
p = re.compile(r'<.*?>')
r, _ = re.subn(r' +', ' ', htmlentitydecode(p.sub('', data)