diff --git a/django_request_cache/__init__.py b/django_request_cache/__init__.py index 04958fa..8fe4e81 100644 --- a/django_request_cache/__init__.py +++ b/django_request_cache/__init__.py @@ -45,12 +45,14 @@ def wrapper(*args, **kwargs): # cache found -> check if a result is already available for this function call key = cache_calculate_key(fn.__name__, *args, **kwargs) - result = getattr(cache, key, None) - if not result: + try: + result = getattr(cache, key) + except AttributeError: # no result available -> execute function result = fn(*args, **kwargs) setattr(cache, key, result) return result return wrapper +