Commit ee380ac 1 parent 9974238 commit ee380ac Copy full SHA for ee380ac
File tree 2 files changed +7
-2
lines changed
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 31
31
def _get_metadata_xml_for_field (root_xml , field_name ):
32
32
if "'" in field_name :
33
33
field_name = sax .escape (field_name , {"'" : "'" })
34
- xpath = ".//metadata-record[@class='column'][local-name='{}']" .format (field_name )
34
+ xpath = u ".//metadata-record[@class='column'][local-name='{}']" .format (field_name )
35
35
return root_xml .find (xpath )
36
36
37
37
Original file line number Diff line number Diff line change @@ -199,4 +199,9 @@ def _read_description(xmldata):
199
199
if description is None :
200
200
return None
201
201
202
- return u'{}' .format (ET .tostring (description , encoding = 'utf-8' )) # This is necessary for py3 support
202
+ description_string = ET .tostring (description , encoding = 'utf-8' )
203
+ # Format expects a unicode string so in Python 2 we have to do the explicit conversion
204
+ if isinstance (description_string , bytes ):
205
+ description_string = description_string .decode ('utf-8' )
206
+
207
+ return description_string
You can’t perform that action at this time.
0 commit comments