def invalidate_resources_cache(**kwargs):
instance = kwargs["instance"]
if instance.__class__.__name__ not in ['Directory', 'Store']:
return
# Don't invalidate if the save didn't create new objects
no_new_objects = (
('created' in kwargs
and 'raw' in kwargs)
and (not kwargs['created']
or kwargs['raw']))
if no_new_objects and instance.parent.get_children():
return
proj_code = split_pootle_path(instance.pootle_path)[1]
if proj_code is not None:
cache.delete(make_method_key(Project, 'resources', proj_code))
评论列表
文章目录