From d8947fad122274a411dc05566bc2c24a7967b9a8 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Mon, 20 Sep 2021 16:11:50 +0200 Subject: [PATCH 03/59] decorators: remove broken and unused decorator (#56982) --- src/authentic2/decorators.py | 13 ------------- tests/cache_urls.py | 15 ++------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/authentic2/decorators.py b/src/authentic2/decorators.py index edbc6eab..bcedec9c 100644 --- a/src/authentic2/decorators.py +++ b/src/authentic2/decorators.py @@ -239,19 +239,6 @@ class RequestCache(SimpleDictionnaryCacheMixin, CacheDecoratorBase): return request.__dict__.setdefault(self.__class__.__name__, {}) -class DjangoCache(SimpleDictionnaryCacheMixin, CacheDecoratorBase): - @property - def cache(self): - return django_cache - - def set(self, key, value): - self.cache.set(key, value, timeout=self.timeout) - - def delete(self, key, value): - if self.get(key) == value: - self.delete(key) - - class PickleCacheMixin: def set(self, key, value): value, tstamp = value diff --git a/tests/cache_urls.py b/tests/cache_urls.py index bdee2916..b8c62bf4 100644 --- a/tests/cache_urls.py +++ b/tests/cache_urls.py @@ -17,18 +17,7 @@ from django.conf.urls import url from django.http import HttpResponse -from authentic2.decorators import DjangoCache, SessionCache - - -@DjangoCache -def cached_function(): - import random - - return random.random() - - -def cached_view(self): - return HttpResponse('%s' % cached_function()) +from authentic2.decorators import SessionCache @SessionCache() @@ -43,4 +32,4 @@ def session_cache(request): return HttpResponse('%s' % value) -urlpatterns = [url(r'^django_cache/$', cached_view), url(r'^session_cache/$', session_cache)] +urlpatterns = [url(r'^session_cache/$', session_cache)] -- 2.30.2