From a106d6c97ef8711794187fa8ed86a35f80463fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20F=C3=A6rl=C3=B8v?= Date: Tue, 15 Sep 2015 13:42:12 +0200 Subject: [PATCH] Fix HTMLSerializer on Py2 shouldn't assert unicode strings. --- html5lib/serializer/htmlserializer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/html5lib/serializer/htmlserializer.py b/html5lib/serializer/htmlserializer.py index be4d6344..fadb5e31 100644 --- a/html5lib/serializer/htmlserializer.py +++ b/html5lib/serializer/htmlserializer.py @@ -1,5 +1,5 @@ from __future__ import absolute_import, division, unicode_literals -from six import text_type +from six import string_types try: from functools import reduce @@ -155,14 +155,14 @@ def __init__(self, **kwargs): self.strict = False def encode(self, string): - assert(isinstance(string, text_type)) + assert(isinstance(string, string_types)) if self.encoding: return string.encode(self.encoding, unicode_encode_errors) else: return string def encodeStrict(self, string): - assert(isinstance(string, text_type)) + assert(isinstance(string, string_types)) if self.encoding: return string.encode(self.encoding, "strict") else: