From a45c25b016705ce1804fadfb456bb0fea1c81fdb Mon Sep 17 00:00:00 2001 From: Wolfgang Kaltz Date: Tue, 27 Aug 2024 17:04:29 +0200 Subject: [PATCH 1/4] Provide a general WMS verify certificate option (#2034) * Provide a general WMS verify certificate option, for cantonal setups whose WMS are served with self-signed certificates --- dev/config/pyramid_oereb.yml.mako | 8 ++++---- .../contrib/data_sources/standard/sources/plr.py | 3 +-- pyramid_oereb/core/readers/real_estate.py | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/dev/config/pyramid_oereb.yml.mako b/dev/config/pyramid_oereb.yml.mako index 94c1228c16..1dc7ed1b75 100644 --- a/dev/config/pyramid_oereb.yml.mako +++ b/dev/config/pyramid_oereb.yml.mako @@ -238,8 +238,6 @@ pyramid_oereb: fr: https://wms.geo.admin.ch/?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&STYLES=default&CRS=EPSG:2056&BBOX=2475000,1065000,2850000,1300000&WIDTH=493&HEIGHT=280&FORMAT=image/png&LAYERS=ch.swisstopo-vd.amtliche-vermessung layer_index: 0 layer_opacity: 1.0 - # Option to check certificate for external WMS. Default and recommended setting: True - verify_certificate: True plan_for_land_register_main_page: # WMS URL to query the plan for land register specially for static extracts overview page reference_wms: @@ -247,8 +245,6 @@ pyramid_oereb: fr: https://wms.geo.admin.ch/?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&STYLES=default&CRS=EPSG:2056&BBOX=2475000,1065000,2850000,1300000&WIDTH=493&HEIGHT=280&FORMAT=image/png&LAYERS=ch.swisstopo-vd.amtliche-vermessung layer_index: 0 layer_opacity: 1.0 - # Option to check certificate for external WMS. Default and recommended setting: True - verify_certificate: True visualisation: method: pyramid_oereb.core.hook_methods.produce_sld_content # Note: these parameters must fit to the attributes provided by the RealEstateRecord!!!! @@ -1413,6 +1409,10 @@ pyramid_oereb: transfer_code: Hinweis extract_code: Hint + # Option to check certificate for external WMS calls in standard and oereblex themes. + # Default and recommended setting: True + verify_certificate_wms: True + # The error message returned if an error occurs when requesting a static extract # The content of the message is defined in the specification (document "Inhalt und Darstellung des statischen Auszugs") static_error_message: diff --git a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py index 2f085cd489..3aa9028ae1 100644 --- a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py +++ b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py @@ -163,8 +163,7 @@ def from_db_to_view_service_record(self, view_service_from_db, legend_entry_reco Config.get('srid'), Config.get('proxies'), legends=legend_entry_records, - # Note: our standard database model does not contain an option to override the verify_certificate - verify_certificate=True + verify_certificate=Config.get('verify_certificate_wms', True) ) return view_service_record diff --git a/pyramid_oereb/core/readers/real_estate.py b/pyramid_oereb/core/readers/real_estate.py index e37d956446..e277533c34 100644 --- a/pyramid_oereb/core/readers/real_estate.py +++ b/pyramid_oereb/core/readers/real_estate.py @@ -64,7 +64,7 @@ def read(self, params, nb_ident=None, number=None, egrid=None, geometry=None): Config.get('default_language'), Config.get('srid'), Config.get('proxies'), - verify_certificate=plan_for_land_register_config.get('verify_certificate', True) + verify_certificate=Config.get('verify_certificate_wms', True) ) plan_for_land_register_main_page_config = Config.get_plan_for_land_register_main_page_config() @@ -75,7 +75,7 @@ def read(self, params, nb_ident=None, number=None, egrid=None, geometry=None): Config.get('default_language'), Config.get('srid'), Config.get('proxies'), - verify_certificate=plan_for_land_register_main_page_config.get('verify_certificate', True) + verify_certificate=Config.get('verify_certificate_wms', True) ) self._source_.read(params, nb_ident=nb_ident, number=number, egrid=egrid, geometry=geometry) From d0e2a571240f512f73a697f6b51aba68e8c592a0 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Tue, 27 Aug 2024 17:06:14 +0200 Subject: [PATCH 2/4] add timeout of 4s in request --- pyramid_oereb/contrib/data_sources/swisstopo/address.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyramid_oereb/contrib/data_sources/swisstopo/address.py b/pyramid_oereb/contrib/data_sources/swisstopo/address.py index 317fb0ea8b..92b62de8a8 100644 --- a/pyramid_oereb/contrib/data_sources/swisstopo/address.py +++ b/pyramid_oereb/contrib/data_sources/swisstopo/address.py @@ -61,7 +61,8 @@ def read(self, params, street_name, zip_code, street_number): self._geoadmin_url, params=request_params, proxies=self._proxies, - headers=headers + headers=headers, + timeout=4 ) if response.status_code == requests.codes.ok: rp = Reprojector() From ec86cb5af4671edd850d5a26c37b5c71dc03ad3b Mon Sep 17 00:00:00 2001 From: Wolfgang Kaltz Date: Tue, 27 Aug 2024 17:12:20 +0200 Subject: [PATCH 3/4] New release --- CHANGES.rst | 5 +++++ doc/source/changes.rst | 7 +++++++ pyproject.toml | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index ffab9bb04b..38f62b2b09 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,11 @@ Notes: ------ - This python package specifies the version numbers only of directly imported python packages. This approach may result in a build failure of older versions of the project if incompatibilities arise between imported packages over time. The build process of the master branch is regularly tested in an automatic process. +2.5.3 +----- +- Provide a general WMS verify certificate option +- Library upgrade (shapely) + 2.5.2 ----- - Add configuration Option to check certificate for external WMS. Default setting: True diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 9eb919fbee..40fa311cb0 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -6,6 +6,13 @@ Changes/Hints for migration This chapter will give you hints on how to handle version migration, in particular regarding what you may need to adapt in your project configuration, database etc. when upgrading to a new version. +Version 2.5.3 +------------- +Feature and maintenance release: + +* Provide a general WMS verify certificate option +* Library upgrade (shapely) + Version 2.5.2 ------------- Feature and maintenance release: diff --git a/pyproject.toml b/pyproject.toml index db124ffb37..dcf901b44b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" [project] name = "pyramid_oereb" -version = "2.5.2" +version = "2.5.3" description = "pyramid_oereb, extension for pyramid web frame work to provide a basic server part for the oereb project" classifiers=[ From 86fe1950e76cef0e70d572498e732b8acb0de29a Mon Sep 17 00:00:00 2001 From: Wolfgang Kaltz Date: Thu, 29 Aug 2024 09:03:32 +0200 Subject: [PATCH 4/4] Fix typo in error message (#2046) --- pyramid_oereb/core/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyramid_oereb/core/config.py b/pyramid_oereb/core/config.py index 22b8da703d..d17b7a3973 100644 --- a/pyramid_oereb/core/config.py +++ b/pyramid_oereb/core/config.py @@ -2098,7 +2098,7 @@ def municipality_by_fosnr(fosnr): if municipality.fosnr == fosnr: return municipality raise ConfigurationError( - 'No municipalitiy with fosnr {} could be found in the configured municipalities ({}).'.format( + 'No municipality with fosnr {} could be found in the configured municipalities ({}).'.format( fosnr, Config.municipalities )