From f1d7258df824b31b6fa39d9d91ce57f98d6c585d Mon Sep 17 00:00:00 2001 From: NiedielnitsevIvan <81557788+NiedielnitsevIvan@users.noreply.github.com> Date: Fri, 29 Mar 2024 14:40:09 +0200 Subject: [PATCH] fix: fix AttributeError when LocMemCache uses in tests (#2524) --- 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))