# HG changeset patch # User RhodeCode Admin # Date 2023-03-10 10:43:16 # Node ID 4bd6e5a3990736d4d4c2dc234096b18bcb6dae2a # Parent 562a7580844953b5106a85c4f39947501aa3d9bd python3: fix itervalues diff --git a/rhodecode/lib/rc_cache/utils.py b/rhodecode/lib/rc_cache/utils.py --- a/rhodecode/lib/rc_cache/utils.py +++ b/rhodecode/lib/rc_cache/utils.py @@ -277,8 +277,7 @@ class InvalidationContext(object): """ def __repr__(self): - return ''.format( - safe_str(self.cache_key), safe_str(self.uid)) + return f'' def __init__(self, uid, invalidation_namespace='', raise_exception=False, thread_scoped=None): @@ -311,9 +310,10 @@ class InvalidationContext(object): cache_obj_map = CacheKey.get_namespace_map(invalidation_namespace) cache_obj = cache_obj_map.get(self.cache_key) log.debug('Fetched cache obj %s using %s cache key.', cache_obj, self.cache_key) + if not cache_obj: new_cache_args = invalidation_namespace - first_cache_obj = next(cache_obj_map.itervalues()) if cache_obj_map else None + first_cache_obj = next(iter(cache_obj_map.values())) if cache_obj_map else None cache_state_uid = None if first_cache_obj: cache_state_uid = first_cache_obj.cache_state_uid