fix custom content type cache __get__ method (#10308)

This commit is contained in:
Frédéric Péters 2016-03-16 11:05:41 +01:00
parent eb0a27e712
commit b3914c84cf
1 changed files with 4 additions and 4 deletions

View File

@ -179,8 +179,8 @@ class FakeTenant:
# Make the ContentType cache tenant and thread safe
ContentTypeManager._thread_local_cache = threading.local()
class ContentTypeCacheDescriptor(object):
def __get__(self, obj):
if not hasattr(obj._thread_local_cache, '_cache'):
obj._thread_local_cache._cache = {}
return obj._thread_local_cache._cache
def __get__(self, obj, owner):
if not hasattr(owner._thread_local_cache, '_cache'):
owner._thread_local_cache._cache = {}
return owner._thread_local_cache._cache
ContentTypeManager._cache = ContentTypeCacheDescriptor()