Skip to content

Commit

Permalink
refactor: remove obsolete HTMLParseError
Browse files Browse the repository at this point in the history
  • Loading branch information
henri-hulski committed May 12, 2022
1 parent 40b0ef7 commit 0d5434b
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions mezzanine/utils/html.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
from html.entities import name2codepoint
from html.parser import HTMLParser

try:
from html.parser import HTMLParseError
except ImportError: # Python 3.5+

class HTMLParseError(Exception):
pass

import re

from mezzanine.utils.deprecation import mark_safe
Expand Down Expand Up @@ -161,12 +154,8 @@ def __init__(self, html):
HTMLParser.__init__(self)
self.html = html
self.tags = []
try:
self.feed(self.html)
except HTMLParseError:
pass
else:
self.html += "".join("</%s>" % tag for tag in self.tags)
self.feed(self.html)
self.html += "".join("</%s>" % tag for tag in self.tags)

def handle_starttag(self, tag, attrs):
if tag not in SELF_CLOSING_TAGS:
Expand Down

0 comments on commit 0d5434b

Please sign in to comment.