diff options
author | elie <elie> | 2013-11-23 18:29:09 +0000 |
---|---|---|
committer | elie <elie> | 2013-11-23 18:29:09 +0000 |
commit | 35a247c060ea28eef49bdc67ed07c5775a5e0eaa (patch) | |
tree | 5e8565dab562e28404d2fcb9476bb97d22f23bf7 /pysnmp/proto | |
parent | 4875617e7ac1b8b67a62c22884d2d585b76071e6 (diff) | |
download | pysnmp-35a247c060ea28eef49bdc67ed07c5775a5e0eaa.tar.gz |
fix to rfc1902.Bits type to make it accepting hex and binary initializers,
cope with missing bits identifieirs at prettyPrint()
Diffstat (limited to 'pysnmp/proto')
-rw-r--r-- | pysnmp/proto/rfc1902.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/pysnmp/proto/rfc1902.py b/pysnmp/proto/rfc1902.py index 121a4d6..6e2742b 100644 --- a/pysnmp/proto/rfc1902.py +++ b/pysnmp/proto/rfc1902.py @@ -107,14 +107,15 @@ class Counter64(univ.Integer): class Bits(univ.OctetString): namedValues = namedval.NamedValues() def __init__(self, value=None, tagSet=None, subtypeSpec=None, + encoding=None, binValue=None, hexValue=None, namedValues=None): if namedValues is None: self.__namedValues = self.namedValues else: self.__namedValues = namedValues univ.OctetString.__init__( - self, value, tagSet, subtypeSpec - ) + self, value, tagSet, subtypeSpec, encoding, binValue, hexValue + ) def prettyIn(self, bits): if not isinstance(bits, (tuple, list)): @@ -143,9 +144,7 @@ class Bits(univ.OctetString): if v & (0x01<<j): name = self.__namedValues.getName(i*8+7-j) if name is None: - raise error.ProtocolError( - 'Unknown named value %s' % v - ) + name = 'UnknownBit-%s' % (i*8+7-j,) names.append(name) j = j - 1 i = i + 1 |