From 0628b515289b683823d257f7d831be3b09dc5bb8 Mon Sep 17 00:00:00 2001 From: FrankApiyo Date: Fri, 23 Aug 2024 11:47:53 +0300 Subject: [PATCH] Refactor get_cacke_key for SubmissionURLThrottle class --- onadata/libs/throttle.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/onadata/libs/throttle.py b/onadata/libs/throttle.py index 6ed4f61f10..32cdddb4ed 100644 --- a/onadata/libs/throttle.py +++ b/onadata/libs/throttle.py @@ -24,10 +24,8 @@ def get_form_owner_or_project_from_url(self, url): return None def get_cache_key(self, request, _): - form_owner_or_project = self.get_form_owner_or_project_from_url(request.path) - if (form_owner_or_project and - request.method == 'POST' - and '/submission' in request.path): + if (request.method == 'POST' and '/submission' in request.path + and self.get_form_owner_or_project_from_url(request.path)): return f"throttle_method_{request.method}_path_{request.path}" return None