summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2016-02-13 20:59:52 +0000
committerelie <elie>2016-02-13 20:59:52 +0000
commit631eb9723d2fec7105697cab0a9b241194bdf269 (patch)
tree58283608cf952262586984293e841213e8a6f1d4
parent15839cd9554a191da4315f1b7753b3747cd37b13 (diff)
downloadpysnmp-git-631eb9723d2fec7105697cab0a9b241194bdf269.tar.gz
fix to missing next() in Python 2.5 at pysnmp.hlapi
-rw-r--r--CHANGES.txt3
-rw-r--r--pysnmp/hlapi/asyncore/sync/cmdgen.py7
-rw-r--r--pysnmp/hlapi/asyncore/sync/ntforg.py7
3 files changed, 16 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 655f96b1..049581f9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -28,7 +28,8 @@ Revision 4.3.2, released 2016-02-12
- Fix to NotificationOriginator to cope with unspecified user callable.
- Fix to OctetString.prettyOut() to pretty-print Python 3 bytes without
'b' qualifier.
-- Fix to better pysmi absense handling.
+- Fix to better pysmi import errors handling.
+- Fix to missing next() in Python 2.5 at pysnmp.hlapi
Revision 4.3.1, released 2015-11-12
-----------------------------------
diff --git a/pysnmp/hlapi/asyncore/sync/cmdgen.py b/pysnmp/hlapi/asyncore/sync/cmdgen.py
index 713ea50a..7d891439 100644
--- a/pysnmp/hlapi/asyncore/sync/cmdgen.py
+++ b/pysnmp/hlapi/asyncore/sync/cmdgen.py
@@ -4,6 +4,7 @@
# Copyright (c) 2005-2016, Ilya Etingof <ilya@glas.net>
# License: http://pysnmp.sf.net/license.html
#
+from sys import version_info
from pysnmp.hlapi.asyncore import cmdgen
from pysnmp.hlapi.varbinds import *
from pysnmp.proto.rfc1905 import endOfMibView
@@ -12,6 +13,12 @@ from pyasn1.type.univ import Null
__all__ = ['getCmd', 'nextCmd', 'setCmd', 'bulkCmd']
+if version_info[:2] < (2, 6):
+ __all__.append('next')
+
+ def next(iter):
+ return iter.next()
+
def getCmd(snmpEngine, authData, transportTarget, contextData,
*varBinds, **options):
"""Creates a generator to perform one or more SNMP GET queries.
diff --git a/pysnmp/hlapi/asyncore/sync/ntforg.py b/pysnmp/hlapi/asyncore/sync/ntforg.py
index 73bce503..a4f22115 100644
--- a/pysnmp/hlapi/asyncore/sync/ntforg.py
+++ b/pysnmp/hlapi/asyncore/sync/ntforg.py
@@ -4,10 +4,17 @@
# Copyright (c) 2005-2016, Ilya Etingof <ilya@glas.net>
# License: http://pysnmp.sf.net/license.html
#
+from sys import version_info
from pysnmp.hlapi.asyncore import ntforg
__all__ = ['sendNotification']
+if version_info[:2] < (2, 6):
+ __all__.append('next')
+
+ def next(iter):
+ return iter.next()
+
def sendNotification(snmpEngine, authData, transportTarget, contextData,
notifyType, varBinds, **options):
"""Creates a generator to send one or more SNMP notifications.