aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/serializers.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2013-02-27 09:10:47 -0500
committerWaylan Limberg <waylan@gmail.com>2013-02-27 09:10:47 -0500
commit579288c5eb684dd09d1ef298929a566f40151205 (patch)
treed10a50f91b8606cd1dea38764168abab92958b0f /markdown/serializers.py
parentb37ab16ba56ac6fe4e64f87521996bad323058f2 (diff)
downloadmarkdown-579288c5eb684dd09d1ef298929a566f40151205.tar.gz
markdown-579288c5eb684dd09d1ef298929a566f40151205.tar.bz2
markdown-579288c5eb684dd09d1ef298929a566f40151205.zip
Now using universal code for Python 2 & 3.
The most notable changes are the use of unicode_literals and absolute_imports. Actually, absolute_imports was the biggest deal as it gives us relative imports. For the first time extensions import markdown relative to themselves. This allows other packages to embed the markdown lib in a subdir of their project and still be able to use our extensions.
Diffstat (limited to 'markdown/serializers.py')
-rw-r--r--markdown/serializers.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/markdown/serializers.py b/markdown/serializers.py
index 22a83d4..977d6e8 100644
--- a/markdown/serializers.py
+++ b/markdown/serializers.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
# markdown/searializers.py
#
# Add x/html serialization to Elementree
@@ -37,7 +38,8 @@
# --------------------------------------------------------------------
-import util
+from __future__ import absolute_import
+from . import util
ElementTree = util.etree.ElementTree
QName = util.etree.QName
if hasattr(util.etree, 'test_comment'):
@@ -251,7 +253,7 @@ def _namespaces(elem, default_namespace=None):
tag = elem.tag
if isinstance(tag, QName) and tag.text not in qnames:
add_qname(tag.text)
- elif isinstance(tag, basestring):
+ elif isinstance(tag, util.string_type):
if tag not in qnames:
add_qname(tag)
elif tag is not None and tag is not Comment and tag is not PI: