Cleaning up some more in the attrcache cleaner.

This commit is contained in:
Griatch 2013-05-14 08:22:18 +02:00
parent ffbc1ad0e7
commit 82b82318d5

View file

@ -273,7 +273,7 @@ if _ENABLE_LOCAL_CACHES:
""" """
global _ATTR_CACHE global _ATTR_CACHE
try: try:
_ATTR_CACHE[hashid(obj)][attrname].no_cache=True _ATTR_CACHE[hashid(obj)][attrname].no_cache = True
del _ATTR_CACHE[hashid(obj)][attrname] del _ATTR_CACHE[hashid(obj)][attrname]
except KeyError: except KeyError:
pass pass
@ -284,11 +284,14 @@ if _ENABLE_LOCAL_CACHES:
""" """
global _ATTR_CACHE global _ATTR_CACHE
if obj: if obj:
for attrname, attrobj in _ATTR_CACHE[hashid(obj)].items(): for attrobj in _ATTR_CACHE[hashid(obj)].values():
attrobj.no_cache = True attrobj.no_cache = True
del _ATTR_CACHE[hashid(obj)] del _ATTR_CACHE[hashid(obj)]
else: else:
# clean cache completely # clean cache completely
for objcache in _ATTR_CACHE.values():
for attrobj in objcache.values():
attrobj.no_cache = True
_ATTR_CACHE = defaultdict(dict) _ATTR_CACHE = defaultdict(dict)