notifications-api-common 0.7.0__tar.gz → 0.7.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.
Files changed (67) hide show
  1. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/CHANGELOG.rst +10 -0
  2. {notifications_api_common-0.7.0/notifications_api_common.egg-info → notifications_api_common-0.7.2}/PKG-INFO +4 -3
  3. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/README.rst +1 -1
  4. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/locale/en/LC_MESSAGES/django.po +1 -1
  5. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/locale/nl/LC_MESSAGES/django.po +1 -1
  6. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/management/commands/register_kanalen.py +2 -1
  7. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/settings.py +2 -0
  8. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/utils.py +21 -0
  9. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2/notifications_api_common.egg-info}/PKG-INFO +4 -3
  10. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/setup.cfg +1 -1
  11. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/tests/test_register_kanalen.py +1 -7
  12. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/tests/test_utils.py +1 -1
  13. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/LICENSE +0 -0
  14. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/MANIFEST.in +0 -0
  15. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/__init__.py +0 -0
  16. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/admin.py +0 -0
  17. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/api/__init__.py +0 -0
  18. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/api/serializers.py +0 -0
  19. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/apps.py +0 -0
  20. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/autoretry.py +0 -0
  21. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/constants.py +0 -0
  22. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/contrib/__init__.py +0 -0
  23. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/contrib/setup_configuration/__init__.py +0 -0
  24. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/contrib/setup_configuration/models.py +0 -0
  25. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/contrib/setup_configuration/steps.py +0 -0
  26. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/kanalen.py +0 -0
  27. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/locale/en/LC_MESSAGES/django.mo +0 -0
  28. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/locale/nl/LC_MESSAGES/django.mo +0 -0
  29. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/management/__init__.py +0 -0
  30. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/management/commands/__init__.py +0 -0
  31. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/management/commands/generate_notificaties.py +0 -0
  32. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/migrations/0001_initial.py +0 -0
  33. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/migrations/0002_notificationsconfig_notifications_api_service.py +0 -0
  34. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/migrations/0003_migrate_api_root.py +0 -0
  35. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/migrations/0004_remove_notificationsconfig_api_root.py +0 -0
  36. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/migrations/0005_auto_20220810_0950.py +0 -0
  37. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/migrations/0006_auto_20221018_1406.py +0 -0
  38. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/migrations/0006_auto_20221213_0214.py +0 -0
  39. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/migrations/0007_auto_20221206_0414.py +0 -0
  40. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/migrations/0008_merge_0006_auto_20221213_0214_0007_auto_20221206_0414.py +0 -0
  41. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/migrations/0009_add_subscription_identifier.py +0 -0
  42. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/migrations/__init__.py +0 -0
  43. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/models.py +0 -0
  44. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/py.typed +0 -0
  45. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/query.py +0 -0
  46. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/tasks.py +0 -0
  47. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/templates/notifications_api_common/kanalen.html +0 -0
  48. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/templates/notifications_api_common/notificaties.md +0 -0
  49. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/tests/__init__.py +0 -0
  50. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/tests/utils.py +0 -0
  51. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/urls.py +0 -0
  52. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/validators.py +0 -0
  53. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/views.py +0 -0
  54. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common/viewsets.py +0 -0
  55. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common.egg-info/SOURCES.txt +0 -0
  56. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common.egg-info/dependency_links.txt +0 -0
  57. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common.egg-info/not-zip-safe +0 -0
  58. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common.egg-info/requires.txt +0 -0
  59. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/notifications_api_common.egg-info/top_level.txt +0 -0
  60. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/pyproject.toml +0 -0
  61. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/setup.py +0 -0
  62. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/tests/test_configuration_steps.py +0 -0
  63. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/tests/test_generate_notificaties.py +0 -0
  64. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/tests/test_kanaal_documentation.py +0 -0
  65. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/tests/test_register_webhook.py +0 -0
  66. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/tests/test_send_message.py +0 -0
  67. {notifications_api_common-0.7.0 → notifications_api_common-0.7.2}/tests/test_subscription_configuration_steps.py +0 -0
@@ -2,6 +2,16 @@
2
2
  Changelog
3
3
  =========
4
4
 
5
+ 0.7.2 (2025-03-28)
6
+ ------------------
7
+
8
+ * Add get_domain() for ``register_kanalen``
9
+
10
+ 0.7.1 (2025-03-20)
11
+ ------------------
12
+
13
+ * Fix quickstart.rst and add ``example.com`` as default value for SITE_DOMAIN
14
+
5
15
  0.7.0 (2025-03-18)
6
16
  ------------------
7
17
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: notifications-api-common
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: Re-usable integration layer for the Common Ground Notifications API specification.
5
5
  Home-page: https://github.com/maykinmedia/notifications-api-common
6
6
  Author: Maykin Media
@@ -54,11 +54,12 @@ Requires-Dist: sphinx-rtd-theme; extra == "docs"
54
54
  Provides-Extra: release
55
55
  Requires-Dist: bumpversion; extra == "release"
56
56
  Requires-Dist: twine; extra == "release"
57
+ Dynamic: license-file
57
58
 
58
59
  notifications-api-common
59
60
  ========================
60
61
 
61
- :Version: 0.7.0
62
+ :Version: 0.7.2
62
63
  :Source: https://github.com/maykinmedia/notifications-api-common
63
64
  :Keywords: notifications, REST, API, Common Ground, ZGW
64
65
  :PythonVersion: 3.10
@@ -1,7 +1,7 @@
1
1
  notifications-api-common
2
2
  ========================
3
3
 
4
- :Version: 0.7.0
4
+ :Version: 0.7.2
5
5
  :Source: https://github.com/maykinmedia/notifications-api-common
6
6
  :Keywords: notifications, REST, API, Common Ground, ZGW
7
7
  :PythonVersion: 3.10
@@ -6,7 +6,7 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: 0.7.0\n"
9
+ "Project-Id-Version: 0.7.2\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
11
  "POT-Creation-Date: 2024-12-12 15:28+0100\n"
12
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
@@ -6,7 +6,7 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: 0.7.0\n"
9
+ "Project-Id-Version: 0.7.2\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
11
  "POT-Creation-Date: 2024-12-12 15:28+0100\n"
12
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
@@ -11,6 +11,7 @@ from requests.exceptions import JSONDecodeError, RequestException
11
11
  from ...kanalen import KANAAL_REGISTRY
12
12
  from ...models import NotificationsConfig
13
13
  from ...settings import get_setting
14
+ from ...utils import get_domain
14
15
 
15
16
  logger = logging.getLogger(__name__)
16
17
 
@@ -77,7 +78,7 @@ def construct_kanaal_request_data(kanaal: str):
77
78
  _kanaal = next(k for k in KANAAL_REGISTRY if k.label == kanaal)
78
79
 
79
80
  # build up own documentation URL
80
- domain = get_setting("SITE_DOMAIN")
81
+ domain = get_domain()
81
82
  protocol = "https" if get_setting("IS_HTTPS") else "http"
82
83
  documentation_url = (
83
84
  f"{protocol}://{domain}{reverse('notifications:kanalen')}#{kanaal}"
@@ -9,6 +9,8 @@ IS_HTTPS = True
9
9
 
10
10
  NOTIFICATIONS_GUARANTEE_DELIVERY = True
11
11
 
12
+ NOTIFICATIONS_API_GET_DOMAIN = "notifications_api_common.utils.get_site_domain"
13
+
12
14
 
13
15
  def get_setting(name: str) -> Any:
14
16
  this_module = sys.modules[__name__]
@@ -2,10 +2,12 @@ from django.conf import settings
2
2
  from django.db import models
3
3
  from django.http import HttpRequest
4
4
  from django.urls import Resolver404, ResolverMatch, get_resolver, get_script_prefix
5
+ from django.utils.module_loading import import_string
5
6
 
6
7
  from rest_framework.viewsets import ViewSet
7
8
 
8
9
  from .kanalen import Kanaal
10
+ from .settings import get_setting
9
11
 
10
12
 
11
13
  def notification_documentation(kanaal: Kanaal):
@@ -74,3 +76,22 @@ def get_resource_for_path(path: str) -> models.Model:
74
76
  filter_kwargs = {viewset.lookup_field: viewset.kwargs[lookup_url_kwarg]}
75
77
 
76
78
  return viewset.get_queryset().get(**filter_kwargs)
79
+
80
+
81
+ def get_domain() -> str:
82
+ """
83
+ Derive the domain where the application is hosted.
84
+ """
85
+ getter = import_string(get_setting("NOTIFICATIONS_API_GET_DOMAIN"))
86
+ return getter()
87
+
88
+
89
+ def get_site_domain() -> str:
90
+ """
91
+ Derive the domain where the application is hosted.
92
+
93
+ You can provide an alternative implementation via the
94
+ ``NOTIFICATIONS_API_GET_DOMAIN`` setting, which takes a dotted path to a
95
+ callable taking no arguments.
96
+ """
97
+ return settings.SITE_DOMAIN
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: notifications-api-common
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: Re-usable integration layer for the Common Ground Notifications API specification.
5
5
  Home-page: https://github.com/maykinmedia/notifications-api-common
6
6
  Author: Maykin Media
@@ -54,11 +54,12 @@ Requires-Dist: sphinx-rtd-theme; extra == "docs"
54
54
  Provides-Extra: release
55
55
  Requires-Dist: bumpversion; extra == "release"
56
56
  Requires-Dist: twine; extra == "release"
57
+ Dynamic: license-file
57
58
 
58
59
  notifications-api-common
59
60
  ========================
60
61
 
61
- :Version: 0.7.0
62
+ :Version: 0.7.2
62
63
  :Source: https://github.com/maykinmedia/notifications-api-common
63
64
  :Keywords: notifications, REST, API, Common Ground, ZGW
64
65
  :PythonVersion: 3.10
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = notifications-api-common
3
- version = 0.7.0
3
+ version = 0.7.2
4
4
  description = Re-usable integration layer for the Common Ground Notifications API specification.
5
5
  long_description = file: README.rst
6
6
  url = https://github.com/maykinmedia/notifications-api-common
@@ -9,7 +9,7 @@ from furl import furl
9
9
 
10
10
  from notifications_api_common.kanalen import KANAAL_REGISTRY, Kanaal
11
11
 
12
- from .conftest import NOTIFICATIONS_API_ROOT, SITE_DOMAIN
12
+ from .conftest import NOTIFICATIONS_API_ROOT
13
13
 
14
14
  KANALEN_LIST_URL = (furl(NOTIFICATIONS_API_ROOT) / "kanaal").url
15
15
 
@@ -31,7 +31,6 @@ def override_kanalen():
31
31
 
32
32
 
33
33
  @pytest.mark.django_db
34
- @override_settings(SITE_DOMAIN=SITE_DOMAIN)
35
34
  def test_register_kanalen_success(
36
35
  notifications_config, requests_mock, override_kanalen
37
36
  ):
@@ -64,7 +63,6 @@ def test_register_kanalen_success(
64
63
 
65
64
 
66
65
  @pytest.mark.django_db
67
- @override_settings(SITE_DOMAIN=SITE_DOMAIN)
68
66
  def test_register_kanalen_from_registry_success(
69
67
  notifications_config, requests_mock, override_kanalen
70
68
  ):
@@ -110,7 +108,6 @@ def test_register_kanalen_from_registry_success(
110
108
 
111
109
 
112
110
  @pytest.mark.django_db
113
- @override_settings(SITE_DOMAIN=SITE_DOMAIN)
114
111
  def test_register_kanalen_existing_kanalen(
115
112
  notifications_config, requests_mock, override_kanalen
116
113
  ):
@@ -200,7 +197,6 @@ def test_register_kanalen_existing_kanalen(
200
197
 
201
198
 
202
199
  @pytest.mark.django_db
203
- @override_settings(SITE_DOMAIN=SITE_DOMAIN)
204
200
  def test_register_kanalen_unknown_url(
205
201
  notifications_config, requests_mock, override_kanalen
206
202
  ):
@@ -224,7 +220,6 @@ def test_register_kanalen_unknown_url(
224
220
 
225
221
 
226
222
  @pytest.mark.django_db
227
- @override_settings(SITE_DOMAIN=SITE_DOMAIN)
228
223
  def test_register_kanalen_incorrect_post(
229
224
  notifications_config, requests_mock, override_kanalen
230
225
  ):
@@ -250,7 +245,6 @@ def test_register_kanalen_incorrect_post(
250
245
 
251
246
 
252
247
  @pytest.mark.django_db
253
- @override_settings(SITE_DOMAIN=SITE_DOMAIN)
254
248
  def test_register_kanalen_update_fails(
255
249
  notifications_config, requests_mock, override_kanalen
256
250
  ):
@@ -3,10 +3,10 @@ from django.test import override_settings
3
3
  from notifications_api_common.settings import get_setting
4
4
 
5
5
 
6
- @override_settings(SITE_DOMAIN="example.com")
7
6
  def test_get_settings():
8
7
  assert get_setting("SITE_DOMAIN") == "example.com"
9
8
 
10
9
 
10
+ @override_settings(SITE_DOMAIN=None)
11
11
  def test_get_settings_null_value():
12
12
  assert get_setting("SITE_DOMAIN") is None