diff --git a/ci_scripts/Dockerfile.deps b/ci_scripts/Dockerfile.deps index d75eb0582..5e3107579 100644 --- a/ci_scripts/Dockerfile.deps +++ b/ci_scripts/Dockerfile.deps @@ -23,11 +23,10 @@ RUN apt-get update && apt install -y \ xvfb # PyQGIS latest version -RUN wget -qO - https://qgis.org/downloads/qgis-2022.gpg.key | \ - gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/qgis-archive.gpg --import && \ - chmod a+r /etc/apt/trusted.gpg.d/qgis-archive.gpg && \ - echo "deb [arch=amd64] https://qgis.org/ubuntu jammy main" >> /etc/apt/sources.list && \ - apt update && apt install -y python3-qgis qgis-server +RUN curl -sS https://download.qgis.org/downloads/qgis-archive-keyring.gpg > /etc/apt/keyrings/qgis-archive-keyring.gpg && \ + echo "deb [signed-by=/etc/apt/keyrings/qgis-archive-keyring.gpg] https://qgis.org/ubuntu jammy main" | \ + tee /etc/apt/sources.list.d/qgis.list && \ + apt-get update && apt-get install -y python3-qgis qgis-server # Yarn diff --git a/ci_scripts/Dockerfile.ltr.deps b/ci_scripts/Dockerfile.ltr.deps index dd0449192..b01c21500 100644 --- a/ci_scripts/Dockerfile.ltr.deps +++ b/ci_scripts/Dockerfile.ltr.deps @@ -22,12 +22,11 @@ RUN apt-get update && apt install -y \ dirmngr \ xvfb -# PyQGIS 3.28 -RUN wget -qO - https://qgis.org/downloads/qgis-2022.gpg.key | \ - gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/qgis-archive.gpg --import && \ - chmod a+r /etc/apt/trusted.gpg.d/qgis-archive.gpg && \ - echo "deb [arch=amd64] https://qgis.org/ubuntu-ltr jammy main" >> /etc/apt/sources.list && \ - apt update && apt install -y python3-qgis qgis-server +# PyQGIS +RUN curl -sS https://download.qgis.org/downloads/qgis-archive-keyring.gpg > /etc/apt/keyrings/qgis-archive-keyring.gpg && \ + echo "deb [signed-by=/etc/apt/keyrings/qgis-archive-keyring.gpg] https://qgis.org/ubuntu-ltr jammy main" | \ + tee /etc/apt/sources.list.d/qgis.list && \ + apt-get update && apt-get install -y python3-qgis qgis-server # Yarn RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ diff --git a/docker-compose.latest.yml b/docker-compose.latest.yml index 18146e800..26ae5d32b 100644 --- a/docker-compose.latest.yml +++ b/docker-compose.latest.yml @@ -1,6 +1,4 @@ # Use QGIS latest release - -version: "3" services: postgis: image: g3wsuite/postgis:11.0-2.5 diff --git a/docker-compose.ltr.yml b/docker-compose.ltr.yml index 5a98ae36d..7557c6f81 100644 --- a/docker-compose.ltr.yml +++ b/docker-compose.ltr.yml @@ -1,4 +1,3 @@ -version: '3' services: postgis: image: g3wsuite/postgis:11.0-2.5 diff --git a/g3w-admin/editing/api/base/views.py b/g3w-admin/editing/api/base/views.py index 6c6eb7211..edaea7104 100644 --- a/g3w-admin/editing/api/base/views.py +++ b/g3w-admin/editing/api/base/views.py @@ -27,7 +27,7 @@ EDITING_POST_DATA_UPDATED) from editing.utils import LayerLock from editing.utils.data import clear_session_for_uploaded_files -from qdjango.apps import get_qgs_project +from qdjango.apps import get_qgs_project, remove_project_from_cache from qdjango.models import Layer from qdjango.utils.data import QGIS_LAYER_TYPE_NO_GEOM from qdjango.utils.validators import feature_validator @@ -526,8 +526,8 @@ def response_commit_mode(self, request): qgis_layer = self.metadata_layer.qgis_layer # Get the project - qgis_project = get_qgs_project(Layer.objects.get( - pk=self.metadata_layer.layer_id).project.qgis_file.path) + project = Layer.objects.get(pk=self.metadata_layer.layer_id).project + qgis_project = get_qgs_project(project.qgis_file.path) # Check if we have transaction groups activated # Performs all operations in the editing buffer if we have transactions @@ -653,9 +653,13 @@ def save_relation(post_relation_data, referencing_layer, ref_insert_ids) -> None except: pass - # clear file uploaded and reset session + # Clear file uploaded and reset session clear_session_for_uploaded_files(request) + # Invalidate /api/config cache e invalidate QGIS project cache + project.invalidate_cache() + qgis_project.read(project.qgis_file.path) + def response_unlock_mode(self, request): """ diff --git a/g3w-admin/qdjango/tests/test_utils.py b/g3w-admin/qdjango/tests/test_utils.py index 7cd8b594e..c9381232d 100644 --- a/g3w-admin/qdjango/tests/test_utils.py +++ b/g3w-admin/qdjango/tests/test_utils.py @@ -34,6 +34,8 @@ QGIS_FILE_MDAL = 'mdal_layer_qgis_322.qgs' QGIS_FILE_EXPRESSION_DEFAULT = 'test_default_field_expression_322.qgs' +from qgis.core import Qgis + class QgisProjectTest(TestCase): @@ -169,7 +171,8 @@ def test_layers(self): self.assertTrue(layer.isVisible) self.assertEqual(layer.srid, 4030) self.assertEqual(layer.editOptions, 1) - self.assertEqual(layer.extent, 'POLYGON((-31.26574700000000462 32.3974759999999975, 69.07032000000000949 32.3974759999999975, 69.07032000000000949 81.85736800000000812, -31.26574700000000462 81.85736800000000812, -31.26574700000000462 32.3974759999999975))') + if Qgis.QGIS_VERSION_INT < 33800: + self.assertEqual(layer.extent, 'POLYGON((-31.26574700000000462 32.3974759999999975, 69.07032000000000949 32.3974759999999975, 69.07032000000000949 81.85736800000000812, -31.26574700000000462 81.85736800000000812, -31.26574700000000462 32.3974759999999975))') # important check datasource, main for shp and raster data # -------------------------------------------------------- @@ -260,7 +263,8 @@ def test_layers(self): if layer.layerId == 'cities10000eu20171228095720113': # check extent - self.assertEqual(layer.extent, 'POLYGON((-9.71666669999999932 35.00999999999999801, 57.35194440000000071 35.00999999999999801, 57.35194440000000071 69.96666670000000465, -9.71666669999999932 69.96666670000000465, -9.71666669999999932 35.00999999999999801))') + if Qgis.QGIS_VERSION_INT < 33800: + self.assertEqual(layer.extent, 'POLYGON((-9.71666669999999932 35.00999999999999801, 57.35194440000000071 35.00999999999999801, 57.35194440000000071 69.96666670000000465, -9.71666669999999932 69.96666670000000465, -9.71666669999999932 35.00999999999999801))') # check editorlayout # -------------------------------------------------------- diff --git a/run_docker_tests.sh b/run_docker_tests.sh index ee307825b..c19bad711 100755 --- a/run_docker_tests.sh +++ b/run_docker_tests.sh @@ -4,7 +4,7 @@ # mounted as /code in the container # Get options paramenter -QGSV="322" +QGSV="ltr" MOD="build" usage() { # Function: Print a help message. @@ -22,8 +22,8 @@ while getopts ":q:m:" options; do q) QGSV=${OPTARG} - if [[ $QGSV != "322" && $QGSV != "latest" ]] ; then - echo "Error: QGIS VERSION can be one of '322', 'latest'." >/dev/stderr + if [[ $QGSV != "ltr" && $QGSV != "latest" ]] ; then + echo "Error: QGIS VERSION can be one of 'ltr', 'latest'." >/dev/stderr exit_abnormal exit 1 fi @@ -75,7 +75,7 @@ $DOCKER_COMMAND cp . g3w-suite:/code/ echo "Execute pip3 install requirements" echo "---------------------------------" -$DOCKER_COMMAND exec g3w-suite sh -c "cd /code/ && python3 -m pip install pip==20.0.2 && pip3 install -r requirements_docker.txt && pip3 install -r requirements_huey.txt" +$DOCKER_COMMAND exec g3w-suite sh -c "cd /code/ && pip3 install -r requirements_docker.txt && pip3 install -r requirements_huey.txt" $DOCKER_COMMAND exec g3w-suite sh -c "cd /code/ && pip3 install -r g3w-admin/caching/requirements.txt" @@ -117,6 +117,8 @@ if [ $MOD == "test" ]; then $DOCKER_COMMAND exec g3w-suite sh -c "cd /code/g3w-admin && python3 manage.py test qtimeseries" + $DOCKER_COMMAND exec g3w-suite sh -c "cd /code/g3w-admin && python3 manage.py test about" + else $DOCKER_COMMAND exec g3w-suite bash fi