apis-acdhch-default-settings 1.7.0__py3-none-any.whl → 1.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- apis_acdhch_default_settings/settings.py +8 -4
- apis_acdhch_default_settings/urls.py +2 -2
- apis_acdhch_default_settings/views.py +29 -0
- {apis_acdhch_default_settings-1.7.0.dist-info → apis_acdhch_default_settings-1.8.0.dist-info}/METADATA +2 -1
- apis_acdhch_default_settings-1.8.0.dist-info/RECORD +11 -0
- apis_acdhch_default_settings/utils.py +0 -22
- apis_acdhch_default_settings-1.7.0.dist-info/RECORD +0 -11
- {apis_acdhch_default_settings-1.7.0.dist-info → apis_acdhch_default_settings-1.8.0.dist-info}/LICENSE +0 -0
- {apis_acdhch_default_settings-1.7.0.dist-info → apis_acdhch_default_settings-1.8.0.dist-info}/WHEEL +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import re
|
|
3
3
|
from typing import Any, Dict
|
|
4
|
+
from pathlib import Path
|
|
4
5
|
|
|
5
6
|
from django.core.management.utils import get_random_secret_key
|
|
6
7
|
import dj_database_url
|
|
@@ -25,10 +26,7 @@ if os.environ.get("SENTRY_DSN"):
|
|
|
25
26
|
|
|
26
27
|
SECRET_KEY = os.environ.get("SECRET_KEY", get_random_secret_key())
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
BASE_DIR = os.path.dirname(
|
|
30
|
-
os.path.dirname(os.path.abspath(os.path.join(__file__, "../")))
|
|
31
|
-
)
|
|
29
|
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
32
30
|
|
|
33
31
|
# Application definition
|
|
34
32
|
# put apis_override_select2js at the beginning of the list
|
|
@@ -43,6 +41,7 @@ INSTALLED_APPS = [
|
|
|
43
41
|
"django.contrib.sessions",
|
|
44
42
|
"django.contrib.messages",
|
|
45
43
|
"django.contrib.staticfiles",
|
|
44
|
+
"django_removals",
|
|
46
45
|
"crispy_forms",
|
|
47
46
|
"crispy_bootstrap4",
|
|
48
47
|
"django_filters",
|
|
@@ -134,6 +133,8 @@ MIDDLEWARE = [
|
|
|
134
133
|
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
|
135
134
|
"csp.middleware.CSPMiddleware",
|
|
136
135
|
"crum.CurrentRequestUserMiddleware",
|
|
136
|
+
# this is used by the apis_core.history module:
|
|
137
|
+
"simple_history.middleware.HistoryRequestMiddleware",
|
|
137
138
|
]
|
|
138
139
|
|
|
139
140
|
# https://docs.djangoproject.com/en/stable/ref/settings/#root-urlconf
|
|
@@ -164,6 +165,9 @@ AUTH_PASSWORD_VALIDATORS = [
|
|
|
164
165
|
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
|
|
165
166
|
]
|
|
166
167
|
|
|
168
|
+
# Default primary key field type
|
|
169
|
+
# https://docs.djangoproject.com/en/stable/ref/settings/#default-auto-field
|
|
170
|
+
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
167
171
|
|
|
168
172
|
# Internationalization
|
|
169
173
|
# https://docs.djangoproject.com/en/stable/topics/i18n/
|
|
@@ -5,7 +5,7 @@ from django.contrib import admin
|
|
|
5
5
|
from django.urls import path
|
|
6
6
|
from django.views.generic import TemplateView
|
|
7
7
|
|
|
8
|
-
from apis_acdhch_default_settings import
|
|
8
|
+
from apis_acdhch_default_settings.views import Imprint
|
|
9
9
|
|
|
10
10
|
from apis_core.apis_entities.api_views import GetEntityGeneric
|
|
11
11
|
|
|
@@ -25,4 +25,4 @@ if "apis_bibsonomy" in settings.INSTALLED_APPS:
|
|
|
25
25
|
)
|
|
26
26
|
|
|
27
27
|
urlpatterns.append(path("", TemplateView.as_view(template_name="base.html")))
|
|
28
|
-
urlpatterns.append(path("imprint",
|
|
28
|
+
urlpatterns.append(path("imprint", Imprint.as_view(), name="imprint"))
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import os
|
|
3
|
+
from django.views.generic import TemplateView
|
|
4
|
+
from django.views.decorators.cache import cache_page
|
|
5
|
+
from django.utils.decorators import method_decorator
|
|
6
|
+
|
|
7
|
+
from django.conf import settings
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@method_decorator(cache_page(60 * 5), name='dispatch')
|
|
11
|
+
class Imprint(TemplateView):
|
|
12
|
+
template_name = "imprint.html"
|
|
13
|
+
|
|
14
|
+
def get_context_data(self) -> str:
|
|
15
|
+
ctx = super().get_context_data()
|
|
16
|
+
base_url = getattr(settings, "ACDH_IMPRINT_URL", "https://imprint.acdh.oeaw.ac.at/")
|
|
17
|
+
redmine_id = getattr(settings, "REDMINE_ID", os.getenv("SERVICE_ID", ""))
|
|
18
|
+
|
|
19
|
+
r = requests.get(f"{base_url}{redmine_id}")
|
|
20
|
+
|
|
21
|
+
if r and redmine_id:
|
|
22
|
+
ctx["imprint"] = r.text
|
|
23
|
+
else:
|
|
24
|
+
ctx["imprint"] = """
|
|
25
|
+
One of our services is currently not available. Please try it later or write
|
|
26
|
+
an email to acdh@oeaw.ac.at; if you are service provider, make sure that you
|
|
27
|
+
provided ACDH_IMPRINT_URL and REDMINE_ID.
|
|
28
|
+
"""
|
|
29
|
+
return ctx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apis-acdhch-default-settings
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.0
|
|
4
4
|
Summary: Default settings for APIS instances at the ACDH-CH
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Birger Schacht
|
|
@@ -15,6 +15,7 @@ Requires-Dist: dj-database-url (>=2.0.0,<3.0.0)
|
|
|
15
15
|
Requires-Dist: django-allow-cidr (>=0.6.0,<0.7.0)
|
|
16
16
|
Requires-Dist: django-auth-ldap (>=4.6.0,<5.0.0)
|
|
17
17
|
Requires-Dist: django-csp (>=3.7,<4.0)
|
|
18
|
+
Requires-Dist: django-removals (>=1.0.5,<2.0.0)
|
|
18
19
|
Requires-Dist: opentelemetry-distro
|
|
19
20
|
Requires-Dist: opentelemetry-exporter-otlp
|
|
20
21
|
Requires-Dist: opentelemetry-instrumentation-asgi
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
apis_acdhch_default_settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
apis_acdhch_default_settings/ldapauth.py,sha256=P1NDgWG2Pp4JzqoETq3VDC3DtECoEIXWBA3Lzn6CUIA,423
|
|
3
|
+
apis_acdhch_default_settings/settings.py,sha256=9D7TwHKldJkzt3WZ9Y3k3d99Kz2sJnzcur9_UvryREw,9361
|
|
4
|
+
apis_acdhch_default_settings/templates/base.html,sha256=c3QhbTzJLzCii-Ck5x0wftHx_Y0aFhPfJUhUVknz_Ks,217
|
|
5
|
+
apis_acdhch_default_settings/templates/imprint.html,sha256=juOqq6yzT9FMhjPjhbofDPZxRNO2fhOLlS478reFjE0,254
|
|
6
|
+
apis_acdhch_default_settings/urls.py,sha256=QOkc8QD0rEj0ftcJWJqVyO9qFAgVXrj1rl9R9jARSqc,1017
|
|
7
|
+
apis_acdhch_default_settings/views.py,sha256=4fwNnkjH-X4T2zojGTFndxvznOl_3JavHbmpDLD6wOA,1022
|
|
8
|
+
apis_acdhch_default_settings-1.8.0.dist-info/LICENSE,sha256=cMJgiPvvZVbZQcWrf-s1Es1W2b8sxKA0C7HlD4n8_Oo,1146
|
|
9
|
+
apis_acdhch_default_settings-1.8.0.dist-info/METADATA,sha256=YikvvRnFWwDBlWXw4_skCDguYVjVxMX0gdeGBD2LImM,1340
|
|
10
|
+
apis_acdhch_default_settings-1.8.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
11
|
+
apis_acdhch_default_settings-1.8.0.dist-info/RECORD,,
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import functools
|
|
2
|
-
import requests
|
|
3
|
-
import os
|
|
4
|
-
|
|
5
|
-
from django.conf import settings
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@functools.cache
|
|
9
|
-
def get_imprint() -> str:
|
|
10
|
-
base_url = getattr(settings, "ACDH_IMPRINT_URL", "https://imprint.acdh.oeaw.ac.at/")
|
|
11
|
-
redmine_id = getattr(settings, "REDMINE_ID", os.getenv("SERVICE_ID", ""))
|
|
12
|
-
|
|
13
|
-
r = requests.get(f"{base_url}{redmine_id}")
|
|
14
|
-
|
|
15
|
-
if r and redmine_id:
|
|
16
|
-
return r.text
|
|
17
|
-
else:
|
|
18
|
-
return """
|
|
19
|
-
One of our services is currently not available. Please try it later or write
|
|
20
|
-
an email to acdh@oeaw.ac.at; if you are service provider, make sure that you
|
|
21
|
-
provided ACDH_IMPRINT_URL and REDMINE_ID.
|
|
22
|
-
"""
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
apis_acdhch_default_settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
apis_acdhch_default_settings/ldapauth.py,sha256=P1NDgWG2Pp4JzqoETq3VDC3DtECoEIXWBA3Lzn6CUIA,423
|
|
3
|
-
apis_acdhch_default_settings/settings.py,sha256=9vmQBm7-mntCUwJUZQ1NWje1YPt4pQrlBARcXSO2jbQ,9161
|
|
4
|
-
apis_acdhch_default_settings/templates/base.html,sha256=c3QhbTzJLzCii-Ck5x0wftHx_Y0aFhPfJUhUVknz_Ks,217
|
|
5
|
-
apis_acdhch_default_settings/templates/imprint.html,sha256=juOqq6yzT9FMhjPjhbofDPZxRNO2fhOLlS478reFjE0,254
|
|
6
|
-
apis_acdhch_default_settings/urls.py,sha256=Fr5zKACUYS31awqERkJNaa_SNKJJLEwlsPIbZsfqyTM,1090
|
|
7
|
-
apis_acdhch_default_settings/utils.py,sha256=9uh0oQMPirTYvGxMg1f8IrOqrsxdxa8UgDJOrZaJdPs,647
|
|
8
|
-
apis_acdhch_default_settings-1.7.0.dist-info/LICENSE,sha256=cMJgiPvvZVbZQcWrf-s1Es1W2b8sxKA0C7HlD4n8_Oo,1146
|
|
9
|
-
apis_acdhch_default_settings-1.7.0.dist-info/METADATA,sha256=hrvVziiFYXVZN1tyyBV4ns8vLSmngFsVzNM81U5-JMg,1292
|
|
10
|
-
apis_acdhch_default_settings-1.7.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
11
|
-
apis_acdhch_default_settings-1.7.0.dist-info/RECORD,,
|
|
File without changes
|
{apis_acdhch_default_settings-1.7.0.dist-info → apis_acdhch_default_settings-1.8.0.dist-info}/WHEEL
RENAMED
|
File without changes
|