diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 726d219e07..7ff42ec7de 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -103,7 +103,7 @@ jobs: sudo apt-get install libpq-dev make doc-html - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.6.1 + uses: JamesIves/github-pages-deploy-action@v4.6.3 with: branch: gh-pages # The branch the action should deploy to. folder: doc/build/html # The folder the action should deploy. diff --git a/CHANGES.rst b/CHANGES.rst index f6cd091dac..ffab9bb04b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,15 @@ Changelog ========= +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.2 +----- +- Add configuration Option to check certificate for external WMS. Default setting: True +- Library upgrades (shapely, geoalchemy2, sqlalchemy, lxml) + 2.5.1 ----- - Library upgrades (SQLAlchemy, shapely, geoalchemy2, responses, urllib3, lxml) @@ -20,7 +29,7 @@ Changelog 2.4.7 ----- -- Add extract_index to disclaimer and general infomation (#1753) +- Add extract_index to disclaimer and general infomation (#1753). Note that this improvement requires an additional attribute "extract_index" in tables "general_information" and "disclaimer" of the main schema. - Interlis bug fix (#1881) - Library upgrades (geoalchemy2, SQLAlchemy, jsonschema, lxml, responses, urllib3, pypdf) - Test coverage improvements diff --git a/Dockerfile b/Dockerfile index 03bf916fc2..8edd46b9f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.12.4-bullseye +FROM python:3.12.5-bullseye ENV DEBIAN_FRONTEND=noninteractive diff --git a/dev/config/pyramid_oereb.yml.mako b/dev/config/pyramid_oereb.yml.mako index 812b8598ad..94c1228c16 100644 --- a/dev/config/pyramid_oereb.yml.mako +++ b/dev/config/pyramid_oereb.yml.mako @@ -238,6 +238,8 @@ 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: @@ -245,6 +247,8 @@ 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!!!! diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 5a71f1e823..9eb919fbee 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.2 +------------- +Feature and maintenance release: + +* Add configuration Option to check certificate for external WMS. Default setting: True +* Library upgrades (shapely, geoalchemy2, sqlalchemy, lxml) + Version 2.5.1 ------------- Maintenance release: diff --git a/pyproject.toml b/pyproject.toml index c60cec5c7b..db124ffb37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" [project] name = "pyramid_oereb" -version = "2.5.1" +version = "2.5.2" description = "pyramid_oereb, extension for pyramid web frame work to provide a basic server part for the oereb project" classifiers=[ @@ -35,15 +35,15 @@ Changelog = "https://github.com/openoereb/pyramid_oereb/blob/master/CHANGES.rst" [project.optional-dependencies] # Dependencies listed in "recommend" must be included in "no-version" without explicit version number recommend = [ - "pypdf==4.2.0", + "pypdf==4.3.1", "filetype==1.2.0", - "geoalchemy2==0.15.1", + "geoalchemy2==0.15.2", "pyramid==2.0.2", "pyramid-debugtoolbar==4.12.1", "qrcode==7.4.2", "image==1.5.33", - "shapely==2.0.4", - "SQLAlchemy==2.0.31", + "shapely==2.0.6", + "SQLAlchemy==2.0.32", "pyaml-env==1.2.1", "urllib3==2.2.2", "waitress==3.0.0", @@ -73,21 +73,21 @@ no-version = [ "pyconizer", "c2cwsgiutils[standard]"] testing = [ - "jsonschema==4.22.0", - "lxml==5.2.2", - "pytest==8.2.2", + "jsonschema==4.23.0", + "lxml==5.3.0", + "pytest==8.3.2", "pytest-cov==5.0.0", "pytest-ordering==0.6", "requests-mock==1.12.1", "responses==0.25.3", "webtest==3.0.0", - "pillow==10.3.0"] + "pillow==10.4.0"] dev = [ - "flake8==7.1.0", + "flake8==7.1.1", "Flake8-pyproject==1.2.3", "pyflakes==3.2.0", - "pycodestyle==2.12.0", - "Sphinx==7.3.7", + "pycodestyle==2.12.1", + "Sphinx==7.4.7", "sphinx_rtd_theme==2.0.0", "psycopg2==2.9.9", "mccabe==0.7.0", diff --git a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py index 729c2c882c..2f085cd489 100644 --- a/pyramid_oereb/contrib/data_sources/standard/sources/plr.py +++ b/pyramid_oereb/contrib/data_sources/standard/sources/plr.py @@ -162,7 +162,9 @@ 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'), - legends=legend_entry_records + legends=legend_entry_records, + # Note: our standard database model does not contain an option to override the verify_certificate + verify_certificate=True ) return view_service_record diff --git a/pyramid_oereb/core/readers/real_estate.py b/pyramid_oereb/core/readers/real_estate.py index b5ec3d98bd..e37d956446 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'), + verify_certificate=plan_for_land_register_config.get('verify_certificate', True) ) 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'), + verify_certificate=plan_for_land_register_main_page_config.get('verify_certificate', True) ) 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 cd88cad012..6893a997f1 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): + srid, proxies=None, legends=None, verify_certificate=True): """ Args: @@ -91,6 +91,7 @@ def __init__(self, reference_wms, layer_index, layer_opacity, default_language, srid (int): The SRID which is used for the WMS. proxies (dict or None): The proxies which may be used legends (list of LegendEntry or None): A list of all relevant legend entries. + verify_certificate (bool): indicates whether call to the WMS shall be verified """ self.reference_wms = reference_wms self.image = dict() # multilingual dict with binary map images resulting from calling the wms link @@ -105,13 +106,13 @@ def __init__(self, reference_wms, layer_index, layer_opacity, default_language, self.default_language = default_language self.srid = srid self.proxies = proxies - if legends is None: self.legends = [] else: for legend in legends: assert isinstance(legend.symbol, ImageRecord) self.legends = legends + self.verify_certificate = verify_certificate @staticmethod def sanitize_layer_index(layer_index): @@ -247,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) + response = requests.get(wms, proxies=self.proxies, verify=self.verify_certificate) 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..529ffbb836 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 + None, + True ) assert isinstance(record.reference_wms, dict) assert isinstance(record.layer_index, int) @@ -30,6 +31,7 @@ def test_init(): assert record.srid == 2056 assert record.proxies is None assert len(record.legends) == 0 + assert record.verify_certificate is True def test_init_with_relation(pyramid_oereb_test_config): @@ -49,7 +51,8 @@ def test_init_with_relation(pyramid_oereb_test_config): 'de', 2056, None, - legend_records + legend_records, + True ) assert isinstance(record.reference_wms, dict) assert isinstance(record.layer_index, int) @@ -63,20 +66,20 @@ def test_init_with_relation(pyramid_oereb_test_config): def test_invalid_layer_index_arguments(pyramid_oereb_test_config): with pytest.raises(AttributeError): - ViewServiceRecord({'de': 'http://example.com'}, -1001, 1, 'de', 2056, None, None) + ViewServiceRecord({'de': 'http://example.com'}, -1001, 1, 'de', 2056, None, None, True) with pytest.raises(AttributeError): - ViewServiceRecord({'de': 'http://example.com'}, 1001, 1, 'de', 2056, None, None) + ViewServiceRecord({'de': 'http://example.com'}, 1001, 1, 'de', 2056, None, None, True) with pytest.warns(UserWarning, match='Type of "layer_index" should be "int"'): - ViewServiceRecord({'de': 'http://example.com'}, 1.0, 1, 'de', 2056, None, None) + ViewServiceRecord({'de': 'http://example.com'}, 1.0, 1, 'de', 2056, None, None, True) def test_invalid_layer_layer_opacity(pyramid_oereb_test_config): with pytest.raises(AttributeError): - ViewServiceRecord({'de': 'http://example.com'}, 1, 2.0, 'de', 2056, None, None) + ViewServiceRecord({'de': 'http://example.com'}, 1, 2.0, 'de', 2056, None, None, True) with pytest.raises(AttributeError): - ViewServiceRecord({'de': 'http://example.com'}, 1, -1.1, 'de', 2056, None, None) + ViewServiceRecord({'de': 'http://example.com'}, 1, -1.1, 'de', 2056, None, None, True) with pytest.warns(UserWarning, match='Type of "layer_opacity" should be "float"'): - ViewServiceRecord({'de': 'http://example.com'}, 1, 1, 'de', 2056, None, None) + ViewServiceRecord({'de': 'http://example.com'}, 1, 1, 'de', 2056, None, None, True) def test_check_min_max_attributes():