tools.web: don't try to striphtml content that is not str or buffer
This commit is contained in:
parent
9b2bc27374
commit
760da8ef61
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user