[FIX] fields: make `copy_cache` not invalidate the cache!

This commit is contained in:
Raphael Collet 2016-01-29 17:39:14 +01:00
parent 08b286111c
commit a688bcdbbd
1 changed files with 3 additions and 1 deletions

View File

@ -64,9 +64,11 @@ def copy_cache(records, env):
for record, target in zip(records, records.with_env(env)):
if not target._cache:
for name, value in record._cache.iteritems():
target[name] = value
if isinstance(value, BaseModel):
target._cache[name] = value.with_env(env)
copy_cache(value, env)
else:
target._cache[name] = value
def resolve_all_mro(cls, name, reverse=False):