diff options
author | bai | 2019-04-24 20:47:45 -0400 |
---|---|---|
committer | bai | 2019-04-24 20:47:45 -0400 |
commit | 81639d2e2de358becc3a69dcfb5190b2e371ee0c (patch) | |
tree | 94f04194d44672fd712d3327178859b775ac189b | |
parent | c94708fe9ef9bdca0dd7da35de36e0b21d9108ec (diff) | |
download | weabot-81639d2e2de358becc3a69dcfb5190b2e371ee0c.tar.gz weabot-81639d2e2de358becc3a69dcfb5190b2e371ee0c.tar.xz weabot-81639d2e2de358becc3a69dcfb5190b2e371ee0c.zip |
Deshabilitado uso de BeautifulSoup.
Ya no usamos HTML por lo que su uso es innecesario.
Es una librería de mierda por lo demás.
-rw-r--r-- | cgi/formatting.py | 10 | ||||
-rw-r--r-- | cgi/post.py | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/cgi/formatting.py b/cgi/formatting.py index 6b2d8bc..373d685 100644 --- a/cgi/formatting.py +++ b/cgi/formatting.py @@ -43,8 +43,8 @@ def format_post(message, ip, parentid, parent_timestamp=0): if Settings.VIDEO_THUMBS: (message, affected) = videoThumbs(message) - if affected: - message = close_html(message) + #if affected: + # message = close_html(message) message = clickableURLs(message) message = checkRefLinks(message, parentid, parent_timestamp) @@ -299,7 +299,11 @@ def close_html(message): Old retarded version of sanitize_html, it just closes open tags. """ import BeautifulSoup - return unicode(BeautifulSoup.BeautifulSoup(message)).replace(' ', '').encode('utf-8') + + message = message.encode('utf-8') + soup = BeautifulSoup.BeautifulSoup(message) + + return unicode(soup).replace(' ', '').encode('utf-8') def sanitize_html(message, decode=True): """ diff --git a/cgi/post.py b/cgi/post.py index 9d6f9c2..8937054 100644 --- a/cgi/post.py +++ b/cgi/post.py @@ -179,7 +179,7 @@ def shortenMsg(message, elid='0', elboard='0'): if len(message_shortened) > limit: message_shortened = message_shortened[:limit] - message_shortened = formatting.close_html(message_shortened) + #message_shortened = formatting.close_html(message_shortened) return True, message_shortened else: |