From 243545bab14df053ab1edcfba632e4a7cfec2036 Mon Sep 17 00:00:00 2001 From: Alexandre Leray Date: Tue, 24 Sep 2013 15:26:00 +0200 Subject: [PATCH] Fixes 115 FragmentWrapper.isstring handles unicode More info on --- AUTHORS.rst | 1 + html5lib/treewalkers/lxmletree.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 4148a6ed..e9780455 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -32,3 +32,4 @@ Patches and suggestions - Juan Carlos Garcia Segovia - Mike West - Marc DM +- Alexandre Leray diff --git a/html5lib/treewalkers/lxmletree.py b/html5lib/treewalkers/lxmletree.py index 375cc2e8..f566dec4 100644 --- a/html5lib/treewalkers/lxmletree.py +++ b/html5lib/treewalkers/lxmletree.py @@ -1,5 +1,5 @@ from __future__ import absolute_import, division, unicode_literals -from six import text_type +from six import text_type, string_types, binary_type from lxml import etree from ..treebuilders.etree import tag_regexp @@ -87,7 +87,7 @@ def __init__(self, fragment_root, obj): self.tail = ensure_str(self.obj.tail) else: self.tail = None - self.isstring = isinstance(obj, str) or isinstance(obj, bytes) + self.isstring = isinstance(obj, string_types) or isinstance(obj, binary_type) # Support for bytes here is Py2 if self.isstring: self.obj = ensure_str(self.obj)