Skip to content

Commit 606a781

Browse files
committed
still trying to make getyRow more robust
1 parent 62c5b6a commit 606a781

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

netsnmpagent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,9 @@ def _getRow(self, indices=[]):
815815
if not isinstance(indices, list):
816816
indices = [indices]
817817
if isinstance(indices[0], _VarType):
818-
matchStr = '.'.join(str(u(x._cvar.value)) for x in indices)
818+
# matchStr = '.'.join(str(u(x._cvar.value)) for x in indices)
819+
# FIXME: make this robust in case index is string or IP
820+
matchStr = '.'.join(str(x._cvar.value) for x in indices)
819821
else:
820822
matchStr = '.'.join(str(x) for x in indices)
821823

netsnmpapi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def b(s):
2121
def u(s):
2222
""" Decodes byte strings to Unicode strings, if necessary. """
2323

24-
return s if isinstance(s, bytes) else s.decode(locale.getpreferredencoding())
25-
# return s if isinstance("Test", bytes) else s.decode(locale.getpreferredencoding())
24+
# FIXME: Testing if "Test" is bytes is probably not very robust
25+
return s if isinstance("Test", bytes) else s.decode(locale.getpreferredencoding())
2626

2727
c_sizet_p = ctypes.POINTER(ctypes.c_size_t)
2828

0 commit comments

Comments
 (0)