From 384477e1b567ad6a0cbc7e0bc4a35b27fcaa2f35 Mon Sep 17 00:00:00 2001 From: Wim De Clercq Date: Mon, 16 Oct 2023 10:09:24 +0200 Subject: [PATCH 1/2] Set gateway back after serializing. Issue #232 --- crabpy/gateway/adressenregister.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/crabpy/gateway/adressenregister.py b/crabpy/gateway/adressenregister.py index b92b22f..6125fd5 100644 --- a/crabpy/gateway/adressenregister.py +++ b/crabpy/gateway/adressenregister.py @@ -20,6 +20,7 @@ def setup_cache(cache_settings, gateway): + if cache_settings is None: if not LONG_CACHE.is_configured: LONG_CACHE.configure("dogpile.cache.null") @@ -43,7 +44,20 @@ def serializer(value): else: if isinstance(value, GatewayObject): value.gateway = None - return original_serializer(value) + + # Create cached result without gateway + result = original_serializer(value) + + # Set gateway back for the response of the cached method. + if isinstance(value, list): + for item in value: + if isinstance(item, GatewayObject): + item.gateway = gateway + else: + if isinstance(value, GatewayObject): + value.gateway = gateway + + return result def deserializer(value): """Add the gateway object after deserializing.""" From d054c0bebfbd27124af00f85a9168f5a56cdbe55 Mon Sep 17 00:00:00 2001 From: Wouter Claeys Date: Mon, 16 Oct 2023 10:43:13 +0200 Subject: [PATCH 2/2] Bump version --- CHANGES.rst | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 6ceb57a..bbae3a7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,8 @@ +1.2.6 (16-10-2023) +------------------ + +- Gateway terugplaatsen na serializen + 1.2.5 (13-10-2023) ------------------ diff --git a/setup.py b/setup.py index 9f303aa..e6a94fa 100755 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name="crabpy", - version="1.2.5", + version="1.2.6", description="Interact with geographical webservices by Informatie Vlaanderen.", long_description=open("README.rst").read() + "\n\n" + open("CHANGES.rst").read(), author="Onroerend Erfgoed",