From 5fb0cdd6f9c4a4aaed8b0b29556a31623a204916 Mon Sep 17 00:00:00 2001 From: Dennis Burke Date: Mon, 11 Jul 2016 16:25:19 -0400 Subject: [PATCH] drop more py26 code and don't revert the fix for #30. --- textile/core.py | 5 +---- textile/utils.py | 9 +++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/textile/core.py b/textile/core.py index 5cac161b..f3300ba2 100644 --- a/textile/core.py +++ b/textile/core.py @@ -31,10 +31,7 @@ from textile.objects import Block, Table -try: - from collections import OrderedDict -except ImportError: - from ordereddict import OrderedDict +from collections import OrderedDict from six.moves import urllib urlparse, urlsplit, urlunsplit, quote, unquote = (urllib.parse.urlparse, diff --git a/textile/utils.py b/textile/utils.py index 22cee8f0..022cda4d 100644 --- a/textile/utils.py +++ b/textile/utils.py @@ -10,10 +10,7 @@ urlparse = urllib.parse.urlparse HTMLParser = html_parser.HTMLParser -try: - from collections import OrderedDict -except ImportError: - from ordereddict import OrderedDict +from collections import OrderedDict from xml.etree import ElementTree @@ -60,8 +57,8 @@ def generate_tag(tag, content, attributes=None): # adding text by assigning it to element_tag.text. That results in # non-ascii text being html-entity encoded. Not bad, but not entirely # matching php-textile either. - element_tag = ElementTree.tostringlist(element, encoding=enc, - method='html') + element_tag = [v.decode(enc) for v in ElementTree.tostringlist(element, encoding=enc, + method='html')] element_tag.insert(len(element_tag) - 1, content) element_text = ''.join(element_tag) return element_text