diff options
author | elie <elie> | 2011-03-17 18:02:55 +0000 |
---|---|---|
committer | elie <elie> | 2011-03-17 18:02:55 +0000 |
commit | 8972b9914e9476f0a34749f4105982b1db9efa65 (patch) | |
tree | f1510dce9010dc80948b1c6d3a5f08dae8ce9225 | |
parent | b87b9346ad625f8f36b8b67d6599ccb5fa201ffa (diff) | |
download | pysnmp-8972b9914e9476f0a34749f4105982b1db9efa65.tar.gz |
minor fixes to pretty printer
-rw-r--r-- | examples/v3arch/manager/ntfrcv.py | 5 | ||||
-rw-r--r-- | examples/v3arch/oneliner/manager/async/nextgen.py | 7 | ||||
-rw-r--r-- | examples/v3arch/twisted/manager/ntfrcv.py | 5 |
3 files changed, 11 insertions, 6 deletions
diff --git a/examples/v3arch/manager/ntfrcv.py b/examples/v3arch/manager/ntfrcv.py index bf39d3d..dc1e7ad 100644 --- a/examples/v3arch/manager/ntfrcv.py +++ b/examples/v3arch/manager/ntfrcv.py @@ -37,8 +37,9 @@ def cbFun(snmpEngine, varBinds, cbCtx): transportDomain, transportAddress = snmpEngine.msgAndPduDsp.getTransportInfo(stateReference) - print 'Notification from %s, SNMP Engine \"%s\", Context \"%s\"' % ( - transportAddress, contextEngineId.prettyPrint(), contextName + print 'Notification from %s, SNMP Engine %s, Context %s' % ( + transportAddress, contextEngineId.prettyPrint(), + contextName.prettyPrint() ) for name, val in varBinds: print '%s = %s' % (name.prettyPrint(), val.prettyPrint()) diff --git a/examples/v3arch/oneliner/manager/async/nextgen.py b/examples/v3arch/oneliner/manager/async/nextgen.py index 940ae5b..a8e538f 100644 --- a/examples/v3arch/oneliner/manager/async/nextgen.py +++ b/examples/v3arch/oneliner/manager/async/nextgen.py @@ -26,10 +26,13 @@ def cbFun( ): print '%s via %s' % (authData, transportTarget) if errorIndication: - print 'SNMP engine error', errorIndication + print errorIndication return 1 if errorStatus: - print 'SNMP error %s at %s' % (errorStatus, errorIndex) + print '%s at %s\n' % ( + errorStatus.prettyPrint(), + errorIndex and varBindTable[-1][int(errorIndex)-1] or '?' + ) return 1 varBindTableRow = varBindTable[-1] for idx in range(len(varBindTableRow)): diff --git a/examples/v3arch/twisted/manager/ntfrcv.py b/examples/v3arch/twisted/manager/ntfrcv.py index 79bc138..5ed8232 100644 --- a/examples/v3arch/twisted/manager/ntfrcv.py +++ b/examples/v3arch/twisted/manager/ntfrcv.py @@ -36,8 +36,9 @@ def cbFun(snmpEngine, varBinds, cbCtx): transportDomain, transportAddress = snmpEngine.msgAndPduDsp.getTransportInfo(stateReference) - print 'Notification from %s, SNMP Engine \"%s\", Context \"%s\"' % ( - transportAddress, contextEngineId.prettyPrint(), contextName + print 'Notification from %s, SNMP Engine %s, Context %s' % ( + transportAddress, contextEngineId.prettyPrint(), + contextName.prettyPrint() ) for name, val in varBinds: print '%s = %s' % (name.prettyPrint(), val.prettyPrint()) |