Skip to content

Fix HTMLSerializer on Py2 shouldn't assert unicode strings. #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions html5lib/serializer/htmlserializer.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down