py3: use function next() instead of next() method on iterator objects

Python 3 introduced a next() function to replace the next()
method on iterator objects. Ref:
http://www.diveintopython3.net/porting-code-to-python-3-with-2to3.html#next

TrivialFix
Change-Id: Ic36d89dd5031a29744323df4e44d5b32d67c1b77
This commit is contained in:
dharmendra 2016-03-17 13:28:51 +05:30 committed by dharmendra kushwaha
parent 8b0d413b1c
commit 3fe3dfe6a1
2 changed files with 5 additions and 5 deletions

View File

@ -450,13 +450,13 @@ class IpRouteCommand(IpDeviceCommandBase):
'match', subnet).split('\n') 'match', subnet).split('\n')
for subnet_route_line in subnet_route_list_lines: for subnet_route_line in subnet_route_list_lines:
i = iter(subnet_route_line.split()) i = iter(subnet_route_line.split())
while(i.next() != 'dev'): while(next(i) != 'dev'):
pass pass
device = i.next() device = next(i)
try: try:
while(i.next() != 'src'): while(next(i) != 'src'):
pass pass
src = i.next() src = next(i)
except Exception: except Exception:
src = '' src = ''
if device != interface_name: if device != interface_name:

View File

@ -29,7 +29,7 @@ class TackerBase(models.ModelBase):
return self return self
def next(self): def next(self):
n = self._i.next().name n = next(self._i).name
return n, getattr(self, n) return n, getattr(self, n)
def __repr__(self): def __repr__(self):