summaryrefslogtreecommitdiff
path: root/pyasn1/type/base.py
diff options
context:
space:
mode:
authorelie <elie>2013-12-02 12:38:20 +0000
committerelie <elie>2013-12-02 12:38:20 +0000
commit4ca0e11991c5045e3e70b164ed9ede979028853a (patch)
treeba85fd9fdb80d25fd3c863818003872a5cec205e /pyasn1/type/base.py
parent6ab22c92a5833238047749ff7ce20f3f507637c1 (diff)
downloadpyasn1-4ca0e11991c5045e3e70b164ed9ede979028853a.tar.gz
the setComponentBy*() methods of all CONSTRUCTED objects now accept optional
exactTypes, matchTags and matchConstraints flags to give apps finer control on when not to perform relevant data consistency checks
Diffstat (limited to 'pyasn1/type/base.py')
-rw-r--r--pyasn1/type/base.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/pyasn1/type/base.py b/pyasn1/type/base.py
index 2380fb0..817aeb6 100644
--- a/pyasn1/type/base.py
+++ b/pyasn1/type/base.py
@@ -38,18 +38,18 @@ class Asn1ItemBase(Asn1Item):
def getEffectiveTagSet(self): return self._tagSet # used by untagged types
def getTagMap(self): return tagmap.TagMap({self._tagSet: self})
- def isSameTypeWith(self, other, ignoreTags=False, ignoreConstraints=False):
+ def isSameTypeWith(self, other, matchTags=True, matchConstraints=True):
return self is other or \
- (ignoreTags or \
+ (not matchTags or \
self._tagSet == other.getTagSet()) and \
- (ignoreConstraints or \
+ (not matchConstraints or \
self._subtypeSpec==other.getSubtypeSpec())
- def isSuperTypeOf(self, other, ignoreTags=False, ignoreConstraints=False):
+ def isSuperTypeOf(self, other, matchTags=True, matchConstraints=True):
"""Returns true if argument is a ASN1 subtype of ourselves"""
- return (ignoreTags or \
+ return (not matchTags or \
self._tagSet.isSuperTagSetOf(other.getTagSet())) and \
- (ignoreConstraints or \
+ (not matchConstraints or \
(self._subtypeSpec.isSuperTypeOf(other.getSubtypeSpec())))
class NoValue:
@@ -244,13 +244,19 @@ class AbstractConstructedAsn1Item(Asn1ItemBase):
self._cloneComponentValues(r, cloneValueFlag)
return r
- def _verifyComponent(self, idx, value): pass
+ def _verifyComponent(self, idx, value, exactTypes=False,
+ matchTags=True, matchConstraints=True):
+ pass
def verifySizeSpec(self): self._sizeSpec(self)
def getComponentByPosition(self, idx):
raise error.PyAsn1Error('Method not implemented')
- def setComponentByPosition(self, idx, value, verifyConstraints=True):
+ def setComponentByPosition(self, idx, value,
+ verifyConstraints=True,
+ exactTypes=False,
+ matchTags=True,
+ matchConstraints=True):
raise error.PyAsn1Error('Method not implemented')
def getComponentType(self): return self._componentType