laforge has uploaded this change for review.

View Change

tlv: Use self._compute_tag() method rather than direct self.tag

The TLV_IE.from_tlv() method is part of a base class that is inherited
by more specific classes. The official way to obtain the tag is the
inherited-class-provided self._compute_tag() method, and *not* a direct
reference to the self.tag member.

This allows for some more obscure TLV parsers, such as the upcoming one
for Proactive Commands in the CAT/OTA context.

Change-Id: I0cd70e31567edc5a0584336efcb5e4282734f6dd
---
M pySim/tlv.py
1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/62/28962/1
diff --git a/pySim/tlv.py b/pySim/tlv.py
index 5acc781..a5baa23 100644
--- a/pySim/tlv.py
+++ b/pySim/tlv.py
@@ -236,7 +236,7 @@
return {}, b''
(rawtag, remainder) = self.__class__._parse_tag_raw(do)
if rawtag:
- if rawtag != self.tag:
+ if rawtag != self._compute_tag():
raise ValueError("%s: Encountered tag %s doesn't match our supported tag %s" %
(self, rawtag, self.tag))
(length, remainder) = self.__class__._parse_len(remainder)

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I0cd70e31567edc5a0584336efcb5e4282734f6dd
Gerrit-Change-Number: 28962
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge@osmocom.org>
Gerrit-MessageType: newchange