laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/37680?usp=email )
Change subject: pySim.tlv: Fix from_dict of nested TLVs
......................................................................
pySim.tlv: Fix from_dict of nested TLVs
The existing logic is wrong. How we call from_dict() doesn't differ if
a member IE itself contains a nested collection: We always must pass a
single-entry dict with the snak-case name of the class to from_dict().
Change-Id: Ic1f9db45db75b887227c2e20785198814cbab0f5
Fixes: OS#6453
---
M pySim/tlv.py
1 file changed, 15 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/80/37680/1
diff --git a/pySim/tlv.py b/pySim/tlv.py
index 8180fd1..bd3c901 100644
--- a/pySim/tlv.py
+++ b/pySim/tlv.py
@@ -495,12 +495,7 @@
# resolve the class for that name; create an instance of it
cls = self.members_by_name[k]
inst = cls()
- if cls.nested_collection_cls:
- # in case of collections, we want to pass the raw
"value" portion to from_dict,
- # as to_dict() below intentionally omits the
collection-class-name as key
- inst.from_dict(i[k])
- else:
- inst.from_dict({k: i[k]})
+ inst.from_dict({k: i[k]})
res.append(inst)
else:
raise ValueError('%s: Unknown TLV Class %s in %s; expected
%s' %
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/37680?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ic1f9db45db75b887227c2e20785198814cbab0f5
Gerrit-Change-Number: 37680
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange