mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-27 15:58:34 +03:00
esim.es2p: Permit ApiParamInteger to be an actual integer
Usually, the specifications say that the integer type is actually transmitted as a JSON string type. However, it seems some implementations do return a native JSON integer type. Let's be tolerant in that regard. Change-Id: I5b47f8bba01225d53eff2ca086e53a2133abed7f
This commit is contained in:
@@ -86,6 +86,8 @@ class ApiParamInteger(ApiParam):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def verify_encoded(cls, data):
|
def verify_encoded(cls, data):
|
||||||
|
if isinstance(data, int):
|
||||||
|
return
|
||||||
if not data.isdecimal():
|
if not data.isdecimal():
|
||||||
raise ValueError('integer (%s) contains non-decimal characters' % data)
|
raise ValueError('integer (%s) contains non-decimal characters' % data)
|
||||||
assert str(int(data)) == data
|
assert str(int(data)) == data
|
||||||
|
|||||||
Reference in New Issue
Block a user