summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2012-08-22 10:55:19 +0000
committerelie <elie>2012-08-22 10:55:19 +0000
commitf70b2a123ca351480f661d711b941e0b870ec0fe (patch)
tree870882df6797873eeaa8597430e1ed641a018d2b
parent22ba8503ceec9ed6ad8da3e37f01cb024d9bb88a (diff)
downloadpysnmp-git-f70b2a123ca351480f661d711b941e0b870ec0fe.tar.gz
fix to MIB data reading routine to make it working with possible Windows
end-of-line's
-rw-r--r--CHANGES.txt1
-rw-r--r--pysnmp/smi/builder.py4
2 files changed, 3 insertions, 2 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 8c3b4e93..7a9c8850 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -76,6 +76,7 @@ Revision 4.2.3
- The notificationType parameter of AsynNotificationOriginator.sendNotification
made defaulted to reflect its optional nature.
- Built-in debugger now supports negating debugging categories.
+- Fix to MIB data reading routine to make it working with possible Windows end-of-line's.
- Fix to CommandGenerator's SNMPv3 engine autodiscovery algorithm
when retryCount is administratively set to 0.
- Fix to Notification Originator to make it communicating a single
diff --git a/pysnmp/smi/builder.py b/pysnmp/smi/builder.py
index 3108d228..fd61d872 100644
--- a/pysnmp/smi/builder.py
+++ b/pysnmp/smi/builder.py
@@ -139,7 +139,7 @@ class ZipMibSource(__AbstractMibSource):
raise IOError('No file in ZIP: %s' % p)
def _getData(self, f, mode=None):
- return self.__loader.get_data(os.path.join(self._srcName, f))
+ return self.__loader.get_data(os.path.join(self._srcName, f)).replace('\r\n', '\n')
class DirMibSource(__AbstractMibSource):
def _init(self):
@@ -158,7 +158,7 @@ class DirMibSource(__AbstractMibSource):
def _getData(self, f, mode):
try:
if f in os.listdir(self._srcName): # make FS case-sensitive
- return open(os.path.join(self._srcName, f), mode).read()
+ return open(os.path.join(self._srcName, f), mode).read().replace('\r\n', '\n')
except OSError:
pass
raise IOError # pretend there's no such file