engine: cache proxy descriptor result on engine's cubes (#38067)

This commit is contained in:
Benjamin Dauvergne 2019-11-29 15:29:48 +01:00
parent 3f7bedf0d3
commit 4701568437
1 changed files with 4 additions and 1 deletions

View File

@ -232,7 +232,10 @@ class ProxyListDescriptor(object):
self.chain = chain
def __get__(self, obj, t=None):
return ProxyList(obj.engine, obj, self.attribute, self.cls, chain=self.chain)
key = '_proxy_list_cache_%s' % id(self)
if key not in obj.__dict__:
obj.__dict__[key] = ProxyList(obj.engine, obj, self.attribute, self.cls, chain=self.chain)
return obj.__dict__[key]
class EngineCube(object):