fixed if statement

This commit is contained in:
ak04nv 2017-09-24 22:23:11 +08:00
parent aecd401c6e
commit 77f5dec68b

View file

@ -751,7 +751,7 @@ class Renderer(object):
styles_cache = {} # cache styles searching styles_cache = {} # cache styles searching
html_text = markdown(markdown_text) html_text = markdown(markdown_text)
encoded = html_text.encode('ascii', 'xmlcharrefreplace') encoded = html_text.encode('ascii', 'xmlcharrefreplace')
if not PY2: if isinstance(encoded, bytes):
# In PY3 bytes-like object needs convert to str # In PY3 bytes-like object needs convert to str
encoded = encoded.decode('ascii') encoded = encoded.decode('ascii')
xml_object = parseString('<html>%s</html>' % encoded) xml_object = parseString('<html>%s</html>' % encoded)