pySim.esim.saip.oid: Allow OID instance in prefix_match()

So far the prefix_match() required a string argument; let's also
permit another OID object to be passed; we internally convert that
to string.

Change-Id: I0feb7782d1813cc46ec78f170eb0fce804aebe3a
This commit is contained in:
Harald Welte
2024-08-16 17:24:28 +02:00
parent 1f477495ec
commit b2970d4bbe

View File

@@ -77,9 +77,9 @@ class OID:
if self.cmp(other) > 0:
return True
def prefix_match(self, oid_str):
def prefix_match(self, oid_str: Union[str, 'OID']):
"""determine if oid_str is equal or below our OID."""
return oid_str.startswith(str(self))
return str(oid_str).startswith(str(self))
class eOID(OID):