when pretty printing indices at rfc1902.ObjectType, quote only strings

pull/45/head
elie 2015-10-10 19:47:54 +00:00
parent e3e7f0d94e
commit 11bbf5bc6f
2 changed files with 4 additions and 1 deletions

View File

@ -7,6 +7,7 @@ Revision 4.3.1, work in progress
- A bunch of convenience shortcuts to rfc1902.ObjectIdentity added
from rfc1902.ObjectType and rfc1902.NotificationType
(.addAsn1MibSource(), .addMibSource(), .loadMibs())
- When pretty printing indices at rfc1902.ObjectType, quote only strings.
- Fix to __doc__ use in setup.py to make -O0 installation mode working.
- Fix to ObjectIdentity->ObjectIdentifier attributes handover
- Fixed crash at oneliner compatibility code on EOM response.

View File

@ -462,10 +462,12 @@ class ObjectIdentity:
def prettyPrint(self):
if self.__state & self.stClean:
s = rfc1902.OctetString()
return '%s::%s%s%s' % (
self.__modName, self.__symName,
self.__indices and '.' or '',
'.'.join(['"%s"' % x.prettyPrint() for x in self.__indices ])
'.'.join([x.isSuperTypeOf(s) and '"%s"' % x.prettyPrint()
or x.prettyPrint() for x in self.__indices ])
)
else:
raise SmiError('%s object not fully initialized' % self.__class__.__name__)