fixed cache key uniqueness even in tests

This commit is contained in:
vabene1111
2022-09-21 16:28:54 +02:00
parent 13d498658c
commit cc1a69eac0

View File

@ -44,7 +44,7 @@ def has_group_permission(user, groups):
return False
groups_allowed = get_allowed_groups(groups)
CACHE_KEY = hash((inspect.stack()[0][3], user, groups_allowed))
CACHE_KEY = hash((inspect.stack()[0][3], (user.pk, user.username, user.email), groups_allowed))
cached_result = cache.get(CACHE_KEY, default=None)
if cached_result is not None:
return cached_result