tools/web: simplify regexp and typo

This commit is contained in:
nemunaire 2015-10-23 23:18:05 +02:00
parent 56c43179f3
commit 5141a0dc17

View File

@ -203,7 +203,7 @@ def striphtml(data):
data -- the string to strip data -- the string to strip
""" """
if not isinstance(data, str) and not isinstance(data, buffer): if not isinstance(data, str) and not isinstance(data, bytes):
return data return data
try: try:
@ -232,6 +232,5 @@ def striphtml(data):
import re import re
r, _ = re.subn(r' +', ' ', return re.sub(r' +', ' ',
unescape(re.sub(r'<.*?>', '', data)).replace('\n', ' ')) unescape(re.sub(r'<.*?>', '', data)).replace('\n', ' '))
return r