From f2b769becb4f04d13d3d8ba723f4c664105f818a Mon Sep 17 00:00:00 2001 From: Bernhard Kaindl Date: Fri, 1 Dec 2023 12:00:00 +0000 Subject: [PATCH] Fix PR#17 commit 'misc changes', it broke list/edit SRs Signed-off-by: Bernhard Kaindl --- XSConsoleHotData.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/XSConsoleHotData.py b/XSConsoleHotData.py index 9e56e7e..45b8d43 100644 --- a/XSConsoleHotData.py +++ b/XSConsoleHotData.py @@ -69,8 +69,9 @@ def __iter__(self): raise Exception(Lang("Cannot iterate over type '")+str(type(iterData))+"'") return self - # This method will hide fields called 'next' in the xapi database. If any appear, __iter__ will need to - # return a new object type and this method will need to be moved into that + # This method will hide fields called '__next__' in the xapi database. + # If any appear, __iter__ will need to return a new object type + # and this method will need to be moved into that: def __next__(self): if len(self.iterKeys) <= 0: raise StopIteration @@ -78,6 +79,9 @@ def __next__(self): retVal.refs[-1] = self.iterKeys.pop(0) return retVal + if sys.version_info < (3, 0): + next = __next__ # Python2 iterator calls next() to get the next item. + def __getitem__(self, inParam): # These are square brackets selecting a particular item from a dict using its OpaqueRef if not isinstance(inParam, (int, HotOpaqueRef)):