mirror of
https://github.com/Unidata/python-awips.git
synced 2025-02-23 14:57:56 -05:00
fix long type for py3 in RequestConstraint
This commit is contained in:
parent
6cb3567e3d
commit
3d7c20a637
1 changed files with 2 additions and 4 deletions
|
@ -136,8 +136,6 @@ class RequestConstraint(object):
|
||||||
Return value coerced to be the same type as otherValue. If this is
|
Return value coerced to be the same type as otherValue. If this is
|
||||||
not possible, just return value unmodified.
|
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__):
|
if not isinstance(value, otherValue.__class__):
|
||||||
try:
|
try:
|
||||||
return otherValue.__class__(value)
|
return otherValue.__class__(value)
|
||||||
|
@ -210,7 +208,7 @@ class RequestConstraint(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _stringify(value):
|
def _stringify(value):
|
||||||
if six.PY2:
|
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)
|
return str(value)
|
||||||
else:
|
else:
|
||||||
# Collections are not allowed; they are handled separately.
|
# Collections are not allowed; they are handled separately.
|
||||||
|
@ -219,7 +217,7 @@ class RequestConstraint(object):
|
||||||
raise TypeError('Constraint values of type ' + repr(type(value)) +
|
raise TypeError('Constraint values of type ' + repr(type(value)) +
|
||||||
'are not allowed')
|
'are not allowed')
|
||||||
else:
|
else:
|
||||||
if isinstance(value, (str, int, long, float)):
|
if isinstance(value, (str, int, bool, float)):
|
||||||
return str(value)
|
return str(value)
|
||||||
else:
|
else:
|
||||||
# Collections are not allowed; they are handled separately.
|
# Collections are not allowed; they are handled separately.
|
||||||
|
|
Loading…
Add table
Reference in a new issue