From 1fbd581bc1008bc91c9c30c815a775872ef8d37f Mon Sep 17 00:00:00 2001 From: Uman Shahzad Date: Tue, 12 Sep 2017 17:39:03 +0500 Subject: [PATCH] Remove `else` block to make enrollment caching path more clear. --- ecommerce/programs/conditions.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ecommerce/programs/conditions.py b/ecommerce/programs/conditions.py index 19e79b9d2e9..d96e6e9047e 100644 --- a/ecommerce/programs/conditions.py +++ b/ecommerce/programs/conditions.py @@ -84,10 +84,9 @@ def is_satisfied(self, offer, basket): # pylint: disable=unused-argument user = basket.owner.username try: enrollments = api.enrollment.get(user=user) + cache.set(cache_key, enrollments, settings.ENROLLMENT_API_CACHE_TIMEOUT) except (ConnectionError, SlumberBaseException, Timeout) as exc: logger.error('Failed to retrieve enrollments: %s', str(exc)) - else: - cache.set(cache_key, enrollments, settings.ENROLLMENT_API_CACHE_TIMEOUT) for course in program['courses']: # If the user is already enrolled in a course, we do not need to check their basket for it