From 3d7c20a637bd39a7df1c270e930533f2cee85efe Mon Sep 17 00:00:00 2001 From: Michael James Date: Sun, 14 Oct 2018 19:48:09 -0600 Subject: [PATCH] fix long type for py3 in RequestConstraint --- .../uf/common/dataquery/requests/RequestConstraint.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dynamicserialize/dstypes/com/raytheon/uf/common/dataquery/requests/RequestConstraint.py b/dynamicserialize/dstypes/com/raytheon/uf/common/dataquery/requests/RequestConstraint.py index 28e6928..6c7c2ec 100644 --- a/dynamicserialize/dstypes/com/raytheon/uf/common/dataquery/requests/RequestConstraint.py +++ b/dynamicserialize/dstypes/com/raytheon/uf/common/dataquery/requests/RequestConstraint.py @@ -136,8 +136,6 @@ class RequestConstraint(object): Return value coerced to be the same type as otherValue. If this is not possible, just return value unmodified. ''' - # cannot use type() because otherValue might be an instance of an - # old-style class (then it would just be of type "instance") if not isinstance(value, otherValue.__class__): try: return otherValue.__class__(value) @@ -210,7 +208,7 @@ class RequestConstraint(object): @staticmethod def _stringify(value): if six.PY2: - if type(value) in {str, int, long, bool, float, unicode}: + if isinstance(value, (str, int, long, bool, float, unicode)): return str(value) else: # Collections are not allowed; they are handled separately. @@ -219,7 +217,7 @@ class RequestConstraint(object): raise TypeError('Constraint values of type ' + repr(type(value)) + 'are not allowed') else: - if isinstance(value, (str, int, long, float)): + if isinstance(value, (str, int, bool, float)): return str(value) else: # Collections are not allowed; they are handled separately.