diff options
author | Filipp Lepalaan <filipp@mac.com> | 2018-04-02 14:47:38 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2018-04-02 14:47:38 +0300 |
commit | fd0eba9bacbe586004aeb131427178bc550cca06 (patch) | |
tree | 92ee8aaf0cd2d0a23133b26f437d44dc4c380d1e /gsxws/objectify.py | |
parent | 741f3329ebf600dc2c0c65c4383b8436fe54bac7 (diff) | |
download | py-gsxws-fd0eba9bacbe586004aeb131427178bc550cca06.tar.gz py-gsxws-fd0eba9bacbe586004aeb131427178bc550cca06.tar.bz2 py-gsxws-fd0eba9bacbe586004aeb131427178bc550cca06.zip |
Better Python 3 support
Diffstat (limited to 'gsxws/objectify.py')
-rw-r--r-- | gsxws/objectify.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gsxws/objectify.py b/gsxws/objectify.py index 7803f43..dfcae79 100644 --- a/gsxws/objectify.py +++ b/gsxws/objectify.py @@ -112,7 +112,7 @@ class GsxElement(objectify.ObjectifiedElement): # Work around lxml chomping leading zeros off of IMEI numbers if name in STRING_TYPES: - return unicode(result.text or '') + return str(result.text or '') if isinstance(result, objectify.NumberElement): return result.pyval @@ -120,7 +120,7 @@ class GsxElement(objectify.ObjectifiedElement): if isinstance(result, objectify.StringElement): name = result.tag result = result.text or '' - result = unicode(result) + result = str(result) if not result: return @@ -157,10 +157,10 @@ def parse(root, response): lookup = objectify.ObjectifyElementClassLookup(tree_class=GsxElement) parser.set_element_class_lookup(lookup) - if isinstance(root, basestring) and os.path.exists(root): + if isinstance(root, str) and os.path.exists(root): root = objectify.parse(root, parser) else: - root = objectify.fromstring(root, parser) + root = objectify.fromstring(root.encode(), parser) return root.find('*//%s' % response) |