commonground-api-common 2.6.5__py3-none-any.whl → 2.6.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commonground-api-common
3
- Version: 2.6.5
3
+ Version: 2.6.6
4
4
  Summary: Commonground API tooling
5
5
  Home-page: https://github.com/maykinmedia/commonground-api-common
6
6
  Author: Maykin Media, VNG-Realisatie
@@ -45,7 +45,7 @@ Provides-Extra: drf-extra-fields
45
45
  Requires-Dist: drf-extra-fields>=3.7.0; extra == "drf-extra-fields"
46
46
  Provides-Extra: tests
47
47
  Requires-Dist: psycopg2; extra == "tests"
48
- Requires-Dist: pytest; extra == "tests"
48
+ Requires-Dist: pytest==8.3.5; extra == "tests"
49
49
  Requires-Dist: pytest-django; extra == "tests"
50
50
  Requires-Dist: pytest-dotenv; extra == "tests"
51
51
  Requires-Dist: pytest-factoryboy; extra == "tests"
@@ -76,7 +76,7 @@ Commonground-API-common - Tooling voor RESTful APIs
76
76
  ===================================================
77
77
 
78
78
 
79
- :Version: 2.6.5
79
+ :Version: 2.6.6
80
80
  :Source: https://github.com/maykinmedia/commonground-api-common
81
81
  :PythonVersion: 3.12
82
82
 
@@ -109,7 +109,7 @@ Features
109
109
  * Niet-negatieve waarde validator
110
110
  * Alfanumerieke waarde (zonder diacritics)
111
111
  * URL-validator (test dat URL bestaat) met pluggable link-checker
112
- * ``UntilNowValidator`` - valideer datetimes tot en met *nu*.
112
+ * ``UntilNowValidator`` - valideer datetimes tot en met *nu*. (Via de TIME_LEEWAY setting kan speling worden toegevoegd)
113
113
  * ``UniekeIdentificatieValidator`` (in combinatie met organisatie)
114
114
  * ``InformatieObjectUniqueValidator`` om te valideren dat M2M entries
115
115
  slechts eenmalig voorkomen
@@ -1,5 +1,5 @@
1
- commonground_api_common-2.6.5.data/scripts/generate_schema,sha256=OpKgzlFc_uzA3TVW_vHSYXAD_feLaCdTEnkWjIcxVzA,280
2
- vng_api_common/__init__.py,sha256=b8L3dijps7oaMPmOpJzOuXwvOcbIuro9wWmuPwiL87o,22
1
+ commonground_api_common-2.6.6.data/scripts/generate_schema,sha256=OpKgzlFc_uzA3TVW_vHSYXAD_feLaCdTEnkWjIcxVzA,280
2
+ vng_api_common/__init__.py,sha256=MJHGx-Qo0nycI7WHSavnK8Mok6HS_De_qLfGWXih6Og,22
3
3
  vng_api_common/admin.py,sha256=WiD6afzO9sJh_Nz7TKsxCiGm49vS0qQH1PxyXnGpEt8,204
4
4
  vng_api_common/apps.py,sha256=QQiJXRmjX9Q91oh0P9fvVnHe3NSYd1cEcUUBw0HLBCA,3690
5
5
  vng_api_common/checks.py,sha256=tOyfV7MMLGh4anrd_W30LvJCxiyQ4sFs1mGd9mtrEc0,1175
@@ -32,7 +32,7 @@ vng_api_common/search.py,sha256=yehS6boCOk1JXLCqAMU-B62hWtbTBSf_WKIVGPgp0Mg,1045
32
32
  vng_api_common/serializers.py,sha256=ohdUC11RGMxZQcN2ekLappgT4SbYz12o4GZ7maVS3RY,13464
33
33
  vng_api_common/urls.py,sha256=9IWHYLlEIIHNaZ_Zq02qNQ2HJpETb7o-89r7yBM_tQs,270
34
34
  vng_api_common/utils.py,sha256=EHqVjZhtqnbU7YrqgYIBss28Sd19jtnTLNaMWLfj3Zw,8203
35
- vng_api_common/validators.py,sha256=oXCSuX1S2vtOW3qlPMNOCHo2W-4R0pkcXnZb2xV9ILs,12845
35
+ vng_api_common/validators.py,sha256=tZkjHPXfcG1FxGXCSNnyFkMQPzFHhlxfyOfNdEOb5js,12978
36
36
  vng_api_common/version.py,sha256=yJV9_yTM7Qnzg0zGNkJQkN9Uai3I_ZUkcyseJRPRk5I,129
37
37
  vng_api_common/views.py,sha256=ARqNuPlrZ0ctzkHTNs7NMyzrji2LvRmrmzrSNmtS-v0,7603
38
38
  vng_api_common/viewsets.py,sha256=jAXKHFRBhNKzkjugpYnXkE2zKvCWwKwZA6_VoiTWjvw,2286
@@ -76,7 +76,7 @@ vng_api_common/audittrails/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCe
76
76
  vng_api_common/audittrails/migrations/_operations.py,sha256=UOMv0zAK8CIQ73cSu6wwQG_hkW46Isdy7JCnljn8GII,3280
77
77
  vng_api_common/authorizations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
78
  vng_api_common/authorizations/admin.py,sha256=Tk0yYKbb005E0XZaYYWbucMf_K5M8Hhz62wSBDi8rhM,813
79
- vng_api_common/authorizations/middleware.py,sha256=KJ3znCXPRMOVqSur62SmBjvC6RcKxtcWq1rzaHdYR98,8416
79
+ vng_api_common/authorizations/middleware.py,sha256=cR7reyRIZmCtH2qONopva8PZKCkwBl3DU-VWJqnL-Z0,8418
80
80
  vng_api_common/authorizations/models.py,sha256=-PwbFceloUz6pbfFp2DB3YfioC2xq63YDm-EVc3U3HE,5160
81
81
  vng_api_common/authorizations/serializers.py,sha256=3HeKWEqhI3UWwI8SttC4rEID-Epbk7SWsC-bEjolbaw,5151
82
82
  vng_api_common/authorizations/utils.py,sha256=GSeHVXia-GHGCN_E4u671r4pGssvcyp9osKFf8Fc8v4,590
@@ -107,7 +107,7 @@ vng_api_common/caching/models.py,sha256=RroS9HFiKNXDV59Odh0x8BO8Az8E81v4gwuprF1A
107
107
  vng_api_common/caching/registry.py,sha256=oXE4kMnVpdp7qvb_goVkCTY5qeY8kB3EDKVX65fPtYc,6207
108
108
  vng_api_common/caching/signals.py,sha256=78ej5cVan-JpNHKzZNAfs0m2ON_TXKphe8ZKtP-6FVY,4615
109
109
  vng_api_common/conf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
110
- vng_api_common/conf/api.py,sha256=tNShwZevKpJ6n713pPGPuUpThcPq-057JAd3xSHW5sU,3158
110
+ vng_api_common/conf/api.py,sha256=F1Aj8jOdN-T0ZYqUtuu-jUjST5XcyYcRFqZc057M0Bc,3160
111
111
  vng_api_common/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
112
112
  vng_api_common/contrib/setup_configuration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
113
113
  vng_api_common/contrib/setup_configuration/models.py,sha256=1-G0hXeRe-x6GYtsAaQeMGXq0-cwU5LMb8KTQWj-pQk,1201
@@ -184,7 +184,7 @@ vng_api_common/tests/auth.py,sha256=IKDWTEFv4Bign4F70-ibsFcnJqRxEJaXvqaPQJWa1xY,
184
184
  vng_api_common/tests/caching.py,sha256=zfIw5cRRvO9cekHZZKfRqZc8cx5IfJUYNmcH6cuIMg4,624
185
185
  vng_api_common/tests/schema.py,sha256=WDvifDQQiKqIpQijpeQ7rYkFroJmuPuHe7zNhl1Bigk,2293
186
186
  vng_api_common/tests/urls.py,sha256=PFrYzQbBC0TFPMEn3uPhcBG0IQs9JsEPqckicJT1UA4,2159
187
- commonground_api_common-2.6.5.dist-info/METADATA,sha256=2AptFlJ9JnnorQ-x3r2Ep60TKF7f6oxpSfM82GB32aM,7129
188
- commonground_api_common-2.6.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
189
- commonground_api_common-2.6.5.dist-info/top_level.txt,sha256=vPismc83zPzWXTmlNCCwfDlFV9iygJYxNJW5iDjKTgw,15
190
- commonground_api_common-2.6.5.dist-info/RECORD,,
187
+ commonground_api_common-2.6.6.dist-info/METADATA,sha256=cWsFJ1YO-TZLhYWVXu6r7Dp-9Qbt9RXbb8lfB97JAvM,7195
188
+ commonground_api_common-2.6.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
189
+ commonground_api_common-2.6.6.dist-info/top_level.txt,sha256=vPismc83zPzWXTmlNCCwfDlFV9iygJYxNJW5iDjKTgw,15
190
+ commonground_api_common-2.6.6.dist-info/RECORD,,
@@ -1 +1 @@
1
- __version__ = "2.6.5"
1
+ __version__ = "2.6.6"
@@ -108,7 +108,7 @@ class JWTAuth:
108
108
  self.encoded,
109
109
  algorithms=["HS256"],
110
110
  options={"verify_signature": False},
111
- leeway=settings.JWT_LEEWAY,
111
+ leeway=settings.TIME_LEEWAY,
112
112
  )
113
113
  except jwt.DecodeError:
114
114
  logger.info("Invalid JWT encountered")
@@ -146,7 +146,7 @@ class JWTAuth:
146
146
  self.encoded,
147
147
  key,
148
148
  algorithms=["HS256"],
149
- leeway=settings.JWT_LEEWAY,
149
+ leeway=settings.TIME_LEEWAY,
150
150
  )
151
151
  except jwt.InvalidSignatureError:
152
152
  logger.exception("Invalid signature - possible payload tampering?")
@@ -8,7 +8,7 @@ __all__ = [
8
8
  "GEMMA_URL_INFORMATIEMODEL_VERSIE",
9
9
  "GEMMA_URL_INFORMATIEMODEL",
10
10
  "GEMMA_URL_TEMPLATE",
11
- "JWT_LEEWAY",
11
+ "TIME_LEEWAY",
12
12
  "JWT_SPECTACULAR_SETTINGS",
13
13
  "LINK_FETCHER",
14
14
  "NOTIFICATIONS_DISABLED",
@@ -95,6 +95,6 @@ vng_repo = "VNG-Realisatie/vng-api-common"
95
95
  vng_branch = "ref-responses"
96
96
  COMMON_SPEC = f"https://raw.githubusercontent.com/{vng_repo}/feature/{vng_branch}/vng_api_common/schemas/common.yaml"
97
97
 
98
- JWT_LEEWAY = 0 # default in PyJWT
98
+ TIME_LEEWAY = 0 # default in PyJWT
99
99
 
100
100
  COMMONGROUND_API_COMMON_GET_DOMAIN = "vng_api_common.utils.get_site_domain"
@@ -1,6 +1,7 @@
1
1
  import json
2
2
  import logging
3
3
  import re
4
+ from datetime import timedelta
4
5
  from typing import Callable
5
6
 
6
7
  from django.conf import settings
@@ -277,6 +278,8 @@ class UntilNowValidator:
277
278
  Validate a datetime to not be in the future.
278
279
 
279
280
  This means that `now` is included.
281
+
282
+ Some leeway can be added with the TIME_LEEWAY setting.
280
283
  """
281
284
 
282
285
  message = _("Ensure this value is not in the future.")
@@ -284,7 +287,7 @@ class UntilNowValidator:
284
287
 
285
288
  @property
286
289
  def limit_value(self):
287
- return timezone.now()
290
+ return timezone.now() + timedelta(seconds=settings.TIME_LEEWAY)
288
291
 
289
292
  def __call__(self, value):
290
293
  if value > self.limit_value: