Skip to content

Commit 6e99c3c

Browse files
committed
six conditional for RequestConstraint types
1 parent 96aa826 commit 6e99c3c

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

dynamicserialize/dstypes/com/raytheon/uf/common/dataquery/requests/RequestConstraint.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#
1212

1313
import re
14+
import six
1415
from dynamicserialize.dstypes.com.raytheon.uf.common.time import DataTime
1516

1617

@@ -208,14 +209,24 @@ def _evalIsNull(self, value):
208209

209210
@staticmethod
210211
def _stringify(value):
211-
if isinstance(value, (str, int, long, float)):
212-
return str(value)
212+
if six.PY2:
213+
if type(value) in {str, int, long, bool, float, unicode}:
214+
return str(value)
215+
else:
216+
# Collections are not allowed; they are handled separately.
217+
# Arbitrary objects are not allowed because the string
218+
# representation may not be sufficient to reconstruct the object.
219+
raise TypeError('Constraint values of type ' + repr(type(value)) +
220+
'are not allowed')
213221
else:
214-
# Collections are not allowed; they are handled separately.
215-
# Arbitrary objects are not allowed because the string
216-
# representation may not be sufficient to reconstruct the object.
217-
raise TypeError('Constraint values of type ' + repr(type(value)) +
218-
'are not allowed')
222+
if isinstance(value, (str, int, long, float)):
223+
return str(value)
224+
else:
225+
# Collections are not allowed; they are handled separately.
226+
# Arbitrary objects are not allowed because the string
227+
# representation may not be sufficient to reconstruct the object.
228+
raise TypeError('Constraint values of type ' + repr(type(value)) +
229+
'are not allowed')
219230

220231
@classmethod
221232
def _constructIn(cls, constraintType, constraintValue):

0 commit comments

Comments
 (0)