Removed unneeded ValueError catching in django.utils.text._replace_entity().

The html.entities.name2codepoint dict contains only valid Unicode
codepoints. Either the key exists and chr() will succeed or the key does
not exist.
This commit is contained in:
Jon Dufresne 2019-08-01 05:30:20 -07:00 committed by Mariusz Felisiak
parent ff111ea5e3
commit e8d0d2a5ef
1 changed files with 1 additions and 1 deletions

View File

@ -351,7 +351,7 @@ def _replace_entity(match):
else: else:
try: try:
return chr(html.entities.name2codepoint[text]) return chr(html.entities.name2codepoint[text])
except (ValueError, KeyError): except KeyError:
return match.group(0) return match.group(0)