Merge pull request #969 from xmo-odoo/8.0-fix-weakset-listification-xmo

Unsafe listification of weakref in Python < 2.7.4
This commit is contained in:
xmo-odoo 2014-07-07 16:15:02 +02:00
commit 48c16e4b26
2 changed files with 4 additions and 4 deletions

View File

@ -756,7 +756,7 @@ class Environment(object):
"""
if not spec:
return
for env in list(self.all):
for env in list(iter(self.all)):
c = env.cache
for field, ids in spec:
if ids is None:
@ -769,7 +769,7 @@ class Environment(object):
def invalidate_all(self):
""" Clear the cache of all environments. """
for env in list(self.all):
for env in list(iter(self.all)):
env.cache.clear()
env.prefetch.clear()
env.computed.clear()

View File

@ -5402,7 +5402,7 @@ class BaseModel(object):
""" If `field` must be recomputed on some record in `self`, return the
corresponding records that must be recomputed.
"""
for env in [self.env] + list(self.env.all):
for env in [self.env] + list(iter(self.env.all)):
if env.todo.get(field) and env.todo[field] & self:
return env.todo[field]
@ -5424,7 +5424,7 @@ class BaseModel(object):
""" Recompute stored function fields. The fields and records to
recompute have been determined by method :meth:`modified`.
"""
for env in list(self.env.all):
for env in list(iter(self.env.all)):
while env.todo:
field, recs = next(env.todo.iteritems())
# evaluate the fields to recompute, and save them to database