From e133129843453f329e64d028812e507c0204dd30 Mon Sep 17 00:00:00 2001 From: Michael James Date: Mon, 15 Oct 2018 14:51:54 -0600 Subject: [PATCH] fix getAttribute(s) encoding/decoding, move to PyData --- awips/dataaccess/PyData.py | 5 ++++- .../uf/common/dataaccess/response/AbstractResponseData.py | 5 +---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/awips/dataaccess/PyData.py b/awips/dataaccess/PyData.py index 01e3150..cd58f65 100644 --- a/awips/dataaccess/PyData.py +++ b/awips/dataaccess/PyData.py @@ -25,7 +25,10 @@ class PyData(IData): self.__attributes = dataRecord.getAttributes() def getAttribute(self, key): - return self.__attributes[key] + if six.PY2: + return self.__attributes[key] + value = self.__attributes[key.encode('utf-8')] + return value.decode('utf-8') def getAttributes(self): return self.__attributes.keys() diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/AbstractResponseData.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/AbstractResponseData.py index 2a79924..12c455d 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/AbstractResponseData.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/AbstractResponseData.py @@ -33,10 +33,7 @@ class AbstractResponseData(six.with_metaclass(abc.ABCMeta, object)): self.locationName = locationName def getAttributes(self): - if six.PY2: - return self.attributes - else: - return [item.decode('utf-8') for item in self.attributes] + return self.attributes def setAttributes(self, attributes): self.attributes = attributes