FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix HTMLSerializer on Python2 shouldn't assert unicode strings. by faerloev · Pull Request #210 · html5lib/html5lib-python · GitHub

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 3 additions & 3 deletions html5lib/serializer/htmlserializer.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL