neels has uploaded this change for review.

View Change

es2p.py: also allow 18 digit ICCID

While at it, also use tuples (const) instead of lists (var).

Tweaked-by: nhofmeyr@sysmocom.de (docstring, tuples)
Change-Id: Iaa6e710132e3f4c6cecc5ff786922f6c0fcfb54e
---
M pySim/esim/es2p.py
1 file changed, 3 insertions(+), 3 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/41/40341/1
diff --git a/pySim/esim/es2p.py b/pySim/esim/es2p.py
index 954c7dc..373714e 100644
--- a/pySim/esim/es2p.py
+++ b/pySim/esim/es2p.py
@@ -27,7 +27,7 @@

class param:
class Iccid(ApiParamString):
- """String representation of 19 or 20 digits, where the 20th digit MAY optionally be the padding
+ """String representation of 18 to 20 digits, where the 20th digit MAY optionally be the padding
character F."""
@classmethod
def _encode(cls, data):
@@ -40,7 +40,7 @@

@classmethod
def verify_encoded(cls, data):
- if len(data) not in [19, 20]:
+ if len(data) not in (18, 19, 20):
raise ValueError('ICCID (%s) length (%u) invalid' % (data, len(data)))

@classmethod
@@ -53,7 +53,7 @@
@classmethod
def verify_decoded(cls, data):
data = str(data)
- if len(data) not in [19, 20]:
+ if len(data) not in (18, 19, 20):
raise ValueError('ICCID (%s) length (%u) invalid' % (data, len(data)))
if len(data) == 19:
decimal_part = data

To view, visit change 40341. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Iaa6e710132e3f4c6cecc5ff786922f6c0fcfb54e
Gerrit-Change-Number: 40341
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr@sysmocom.de>
Gerrit-CC: laforge <laforge@osmocom.org>