diff options
author | Ilya Etingof <ietingof@redhat.com> | 2017-02-02 00:53:37 +0100 |
---|---|---|
committer | Ilya Etingof <ietingof@redhat.com> | 2017-02-02 00:53:37 +0100 |
commit | c55dc1735a6d029001f84fa11891ee4f90558cc3 (patch) | |
tree | 336d423052ccf9122d1ba85c686bf3b8912bc098 | |
parent | f14ec6c68ee00670d258073c7e7b5b7b93a77849 (diff) | |
download | pysnmp-git-c55dc1735a6d029001f84fa11891ee4f90558cc3.tar.gz |
fix to TextualConvention initializer: trigger prettyIn parser by "text" input
-rw-r--r-- | pysnmp/smi/mibs/SNMPv2-TC.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pysnmp/smi/mibs/SNMPv2-TC.py b/pysnmp/smi/mibs/SNMPv2-TC.py index e7a9f031..2c4edb73 100644 --- a/pysnmp/smi/mibs/SNMPv2-TC.py +++ b/pysnmp/smi/mibs/SNMPv2-TC.py @@ -262,7 +262,9 @@ class TextualConvention: 'd': octets.str2octs(string.digits) } - if octets.isStringType(value): + # how do we know if object is initialized with display-hint + # formatted text? based on "text" input maybe? + if octets.isStringType(value) and not octets.isOctetsType(value): value = base.prettyIn(self, value) else: return base.prettyIn(self, value) @@ -303,7 +305,7 @@ class TextualConvention: displayFormat = displayHint[0] displayHint = displayHint[1:] - # 4 this is the lifesaver -- we could cut by it + # 4 this is the lifesaver -- we could use it as an anchor if displayHint and displayHint[0] not in string.digits and displayHint[0] != '*': displaySep = displayHint[0] displayHint = displayHint[1:] |