From 6669b1a49920549cc3027165990e86a6020d4f25 Mon Sep 17 00:00:00 2001 From: Wolfgang Kaltz Date: Mon, 1 Jul 2024 11:15:33 +0200 Subject: [PATCH] Add new configuration option --- pyramid_oereb/contrib/data_sources/standard/sources/plr.py | 1 + pyramid_oereb/core/readers/real_estate.py | 6 ++++-- pyramid_oereb/core/records/view_service.py | 4 ++-- tests/core/records/test_view_service.py | 5 ++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py index 729c2c882c..6993e55ee7 100644 --- a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py +++ b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py @@ -162,6 +162,7 @@ def from_db_to_view_service_record(self, view_service_from_db, legend_entry_reco Config.get('default_language'), Config.get('srid'), Config.get('proxies'), + Config.get('verify_certificate'), legends=legend_entry_records ) return view_service_record diff --git a/pyramid_oereb/core/readers/real_estate.py b/pyramid_oereb/core/readers/real_estate.py index b5ec3d98bd..e09a188f3e 100644 --- a/pyramid_oereb/core/readers/real_estate.py +++ b/pyramid_oereb/core/readers/real_estate.py @@ -63,7 +63,8 @@ def read(self, params, nb_ident=None, number=None, egrid=None, geometry=None): plan_for_land_register_config.get('layer_opacity'), Config.get('default_language'), Config.get('srid'), - Config.get('proxies') + Config.get('proxies'), + Config.get('verify_certificate') ) plan_for_land_register_main_page_config = Config.get_plan_for_land_register_main_page_config() @@ -73,7 +74,8 @@ def read(self, params, nb_ident=None, number=None, egrid=None, geometry=None): plan_for_land_register_main_page_config.get('layer_opacity'), Config.get('default_language'), Config.get('srid'), - Config.get('proxies') + Config.get('proxies'), + Config.get('verify_certificate') ) self._source_.read(params, nb_ident=nb_ident, number=number, egrid=egrid, geometry=geometry) diff --git a/pyramid_oereb/core/records/view_service.py b/pyramid_oereb/core/records/view_service.py index 11e9d7cf64..7b60099167 100644 --- a/pyramid_oereb/core/records/view_service.py +++ b/pyramid_oereb/core/records/view_service.py @@ -80,7 +80,7 @@ class ViewServiceRecord(object): """ def __init__(self, reference_wms, layer_index, layer_opacity, default_language, - srid, proxies=None, legends=None, verify_certificate=True): + srid, proxies=None, verify_certificate=True, legends=None): """ Args: @@ -248,7 +248,7 @@ def download_wms_content(self, language): if uri_validator(wms): log.debug(f"Downloading image, url: {wms}") try: - response = requests.get(wms, proxies=self.proxies, verify=self.verify_certificate) + response = requests.get(wms, proxies=self.proxies) except Exception as ex: dedicated_msg = f"An image could not be downloaded. URL was: {wms}, error was {ex}" log.error(dedicated_msg) diff --git a/tests/core/records/test_view_service.py b/tests/core/records/test_view_service.py index fb9f1ee968..67d1eb7422 100644 --- a/tests/core/records/test_view_service.py +++ b/tests/core/records/test_view_service.py @@ -20,7 +20,8 @@ def test_init(): 'de', 2056, None, - None + True, + None, ) assert isinstance(record.reference_wms, dict) assert isinstance(record.layer_index, int) @@ -29,6 +30,7 @@ def test_init(): assert record.default_language == 'de' assert record.srid == 2056 assert record.proxies is None + assert record.verify_certificate is True assert len(record.legends) == 0 @@ -49,6 +51,7 @@ def test_init_with_relation(pyramid_oereb_test_config): 'de', 2056, None, + True, legend_records ) assert isinstance(record.reference_wms, dict)