summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2018-09-05 14:49:23 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2018-09-05 15:09:31 (GMT)
commita1fa7d36dfdec71de154f4713471c901549a5e61 (patch)
tree3b65e854c46bbc7e1fed249d9e6aab109b4005da
parentd026ce40e179d9d9bb9cf3a77fbf88c690ed7198 (diff)
downloaddjango-mellon-a1fa7d36dfdec71de154f4713471c901549a5e61.zip
django-mellon-a1fa7d36dfdec71de154f4713471c901549a5e61.tar.gz
django-mellon-a1fa7d36dfdec71de154f4713471c901549a5e61.tar.bz2
don't cache local metadata anymore (#13881)v1.2.38
-rw-r--r--mellon/utils.py26
-rw-r--r--tests/test_utils.py1
2 files changed, 10 insertions, 17 deletions
diff --git a/mellon/utils.py b/mellon/utils.py
index 524f402..2372f96 100644
--- a/mellon/utils.py
+++ b/mellon/utils.py
@@ -18,18 +18,16 @@ from . import app_settings
def create_metadata(request):
entity_id = reverse('mellon_metadata')
- cache = getattr(settings, '_MELLON_METADATA_CACHE', {})
- if not entity_id in cache:
- login_url = reverse(app_settings.LOGIN_URL)
- logout_url = reverse(app_settings.LOGOUT_URL)
- public_keys = []
- for public_key in app_settings.PUBLIC_KEYS:
- if public_key.startswith('/'):
- # clean PEM file
- public_key = ''.join(open(public_key).read().splitlines()[1:-1])
- public_keys.append(public_key)
- name_id_formats = app_settings.NAME_ID_FORMATS
- cache[entity_id] = render_to_string('mellon/metadata.xml', {
+ login_url = reverse(app_settings.LOGIN_URL)
+ logout_url = reverse(app_settings.LOGOUT_URL)
+ public_keys = []
+ for public_key in app_settings.PUBLIC_KEYS:
+ if public_key.startswith('/'):
+ # clean PEM file
+ public_key = ''.join(open(public_key).read().splitlines()[1:-1])
+ public_keys.append(public_key)
+ name_id_formats = app_settings.NAME_ID_FORMATS
+ return render_to_string('mellon/metadata.xml', {
'entity_id': request.build_absolute_uri(entity_id),
'login_url': request.build_absolute_uri(login_url),
'logout_url': request.build_absolute_uri(logout_url),
@@ -40,10 +38,6 @@ def create_metadata(request):
'contact_persons': app_settings.CONTACT_PERSONS,
'discovery_endpoint_url': request.build_absolute_uri(reverse('mellon_login')),
})
- settings._MELLON_METADATA_CACHE = cache
- return settings._MELLON_METADATA_CACHE[entity_id]
-
-SERVERS = {}
def create_server(request):
diff --git a/tests/test_utils.py b/tests/test_utils.py
index f984b86..8c4cf9c 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -153,7 +153,6 @@ def test_create_metadata(rf, private_settings, caplog):
('/ds:X509Certificate[text()=\'xxx\']', 1),
('/ds:X509Certificate[text()=\'yyy\']', 1)))),
namespaces=ns)
- assert metadata is create_metadata(request)
def test_iso8601_to_datetime(private_settings):