apis-acdhch-default-settings 1.1.2__tar.gz → 1.2.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apis-acdhch-default-settings
3
- Version: 1.1.2
3
+ Version: 1.2.2
4
4
  Summary: Default settings for APIS instances at the ACDH-CH
5
5
  License: MIT
6
6
  Author: Birger Schacht
@@ -10,6 +10,7 @@ Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.11
12
12
  Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
13
14
  Requires-Dist: dj-database-url (>=2.0.0,<3.0.0)
14
15
  Requires-Dist: django-allow-cidr (>=0.6.0,<0.7.0)
15
16
  Requires-Dist: django-auth-ldap (>=4.6.0,<5.0.0)
@@ -49,6 +49,7 @@ INSTALLED_APPS = [
49
49
  "django_tables2",
50
50
  "rest_framework",
51
51
  "apis_ontology",
52
+ "apis_acdhch_default_settings",
52
53
  "apis_core.apis_relations",
53
54
  "apis_core.apis_entities",
54
55
  "apis_core.apis_metainfo",
@@ -57,7 +58,6 @@ INSTALLED_APPS = [
57
58
  "apis_core.core",
58
59
  "rest_framework.authtoken",
59
60
  "drf_spectacular",
60
- "csvexport",
61
61
  ]
62
62
 
63
63
  # https://docs.djangoproject.com/en/5.0/ref/settings/#std-setting-USE_X_FORWARDED_HOST
@@ -240,3 +240,9 @@ LOGGING = {
240
240
  "level": "DEBUG",
241
241
  },
242
242
  }
243
+
244
+ # Our deployment infrastructure sets the GITLAB_ENVIRONMENT_URL to the
245
+ # repository from which the instance is deployed. Lets reuse this
246
+ # information to set the repository url in APIS
247
+ if os.environ.get("GITLAB_ENVIRONMENT_URL"):
248
+ GIT_REPOSITORY_URL = os.environ.get("GITLAB_ENVIRONMENT_URL")
@@ -0,0 +1,5 @@
1
+ {% extends "base.html" %}
2
+ {% block imprint %}
3
+ {% url "imprint" as imprint_url %}
4
+ {% if imprint_url %}<a href="{{ imprint_url }}">Imprint | Impressum</a>{% endif %}
5
+ {% endblock imprint %}
@@ -0,0 +1,11 @@
1
+ {% extends basetemplate|default:"base.html" %}
2
+
3
+ {% block title %}Imprint{% endblock %}
4
+
5
+ {% block content %}
6
+ <div class="container">
7
+ <div class="card imprint">
8
+ <div class="card-body">{{ imprint|safe }}</div>
9
+ </div>
10
+ </div>
11
+ {% endblock %}
@@ -4,6 +4,8 @@ from django.contrib import admin
4
4
  from django.urls import path
5
5
  from django.views.generic import TemplateView
6
6
 
7
+ from apis_acdhch_default_settings import utils
8
+
7
9
  from apis_core.apis_entities.api_views import GetEntityGeneric
8
10
 
9
11
  urlpatterns = [
@@ -25,3 +27,4 @@ if "apis_bibsonomy" in settings.INSTALLED_APPS:
25
27
  )
26
28
 
27
29
  urlpatterns.append(path("", TemplateView.as_view(template_name="base.html")))
30
+ urlpatterns.append(path("imprint", TemplateView.as_view(template_name="imprint.html", extra_context={"imprint": utils.get_imprint()}), name="imprint"))
@@ -0,0 +1,22 @@
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,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "apis-acdhch-default-settings"
3
- version = "1.1.2"
3
+ version = "1.2.2"
4
4
  description = "Default settings for APIS instances at the ACDH-CH"
5
5
  authors = ["Birger Schacht <birger.schacht@oeaw.ac.at>"]
6
6
  license = "MIT"