summaryrefslogtreecommitdiff
path: root/odoo/tools/misc.py
diff options
context:
space:
mode:
authorxmo-odoo <xmo@odoo.com>2017-04-25 13:04:54 +0200
committerGitHub <noreply@github.com>2017-04-25 13:04:54 +0200
commit3cbca4b7348b60eb6cfe3f423983d53dada67862 (patch)
tree0ee9739f66c5616219e50f9e21dc4d416f09b454 /odoo/tools/misc.py
parent4441237b0a80cc8eca04a35ad825bce876a2d7b6 (diff)
[FIX] iterator definition & stepping
* in P3, the iterator stepping method has become a dunder method (next -> __next__), the protocol has not changed, add a __next__ alias to the iterator-next definition (nota: ir.config also has a next method but it's not part of an iterator, so don't alias it and don't convert calls to it) * since ~2.6, a builtin (next()) has been added to step an iterator & allow for a default (in case of iterator end), convert all manual stepping to the builtin Fixers: libfuturize.fixes.fix_next_call #8530
Diffstat (limited to 'odoo/tools/misc.py')
-rw-r--r--odoo/tools/misc.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/odoo/tools/misc.py b/odoo/tools/misc.py
index ebeb65c3523..f080d3067ca 100644
--- a/odoo/tools/misc.py
+++ b/odoo/tools/misc.py
@@ -376,7 +376,7 @@ def scan_languages():
result = []
with open(csvpath) as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
- fields = reader.next()
+ fields = next(reader)
code_index = fields.index("code")
name_index = fields.index("name")
for row in reader:
@@ -833,6 +833,7 @@ class CountingStream(object):
self.stopped = True
raise StopIteration()
return val
+ __next__ = next
def stripped_sys_argv(*strip_args):
"""Return sys.argv with some arguments stripped, suitable for reexecution or subprocesses"""