From de836ff07e9a71e9765fd90f9f4e6ccee2f53752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Fri, 29 Mar 2024 13:31:59 +0200 Subject: [PATCH] fix: fix AttributeError when LocMemCache uses in tests --- cms/djangoapps/contentstore/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index fcfd24df55da..8579c045255b 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -2298,4 +2298,6 @@ def drop_course_sidebar_blocks_cache(course_id: str): """ Drop the course sidebar blocks cache for the given course. """ - cache.delete_many(cache.iter_keys(f"course_sidebar_blocks_{course_id}*")) + cache_key_prefix = f"course_sidebar_blocks_{course_id}" + all_cache_keys = cache.keys('*') if hasattr(cache, 'keys') else [] + cache.delete_many(filter(lambda key: key.startswith(cache_key_prefix), all_cache_keys))