fix getAttribute(s) encoding/decoding, move to PyData

This commit is contained in:
Michael James 2018-10-15 14:51:54 -06:00
parent c7ed7e6242
commit e133129843
2 changed files with 5 additions and 5 deletions

View file

@ -25,7 +25,10 @@ class PyData(IData):
self.__attributes = dataRecord.getAttributes() self.__attributes = dataRecord.getAttributes()
def getAttribute(self, key): def getAttribute(self, key):
if six.PY2:
return self.__attributes[key] return self.__attributes[key]
value = self.__attributes[key.encode('utf-8')]
return value.decode('utf-8')
def getAttributes(self): def getAttributes(self):
return self.__attributes.keys() return self.__attributes.keys()

View file

@ -33,10 +33,7 @@ class AbstractResponseData(six.with_metaclass(abc.ABCMeta, object)):
self.locationName = locationName self.locationName = locationName
def getAttributes(self): def getAttributes(self):
if six.PY2:
return self.attributes return self.attributes
else:
return [item.decode('utf-8') for item in self.attributes]
def setAttributes(self, attributes): def setAttributes(self, attributes):
self.attributes = attributes self.attributes = attributes