summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2008-02-04 08:52:13 +0000
committerelie <elie>2008-02-04 08:52:13 +0000
commita83247ae545f7db4197076d208ba7cf95a71a379 (patch)
tree547ab1b0c0849d454bb8fd47bfeda535b73451cc
parent637202f116a8c15d528ec48cf328862ed0785041 (diff)
downloadpysnmp-a83247ae545f7db4197076d208ba7cf95a71a379.tar.gz
use getLabel() SMI object method when building MIB tree in addition
to direct attribute access for clearer object protocol
-rw-r--r--pysnmp/smi/builder.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/pysnmp/smi/builder.py b/pysnmp/smi/builder.py
index 15c5553..9f6622c 100644
--- a/pysnmp/smi/builder.py
+++ b/pysnmp/smi/builder.py
@@ -1,5 +1,5 @@
# MIB modules loader
-import os
+import os, types
from pysnmp.smi import error
try:
import pysnmp_mibs
@@ -142,8 +142,11 @@ class MibBuilder:
raise error.SmiError(
'Symbol %s already exported at %s' % (symName, modName)
)
- if hasattr(symObj, 'label') and symObj.label:
- symName = symObj.label
+
+ if hasattr(symObj, 'label'):
+ symName = symObj.label or symName # class
+ if type(symObj) == types.InstanceType:
+ symName = symObj.getLabel() or symName # class instance
mibSymbols[symName] = symObj