diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 67fceef686f..96d32f8d288 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -4,6 +4,9 @@ version: '3.9' x-common-django: &default-common-django image: 52north/geonode:local + build: + context: ./ + dockerfile: Dockerfile restart: unless-stopped env_file: - .env @@ -23,9 +26,6 @@ services: # Our custom django application. It includes Geonode. django: << : *default-common-django - build: - context: ./ - dockerfile: Dockerfile container_name: django4${COMPOSE_PROJECT_NAME} healthcheck: test: "curl -m 10 --fail --silent --write-out 'HTTP CODE : %{http_code}\n' --output /dev/null http://django:8000/" diff --git a/docker-compose-test.yml b/docker-compose-test.yml index 31a0f75eb90..b30be048e6c 100644 --- a/docker-compose-test.yml +++ b/docker-compose-test.yml @@ -4,6 +4,9 @@ version: '3.9' x-common-django: &default-common-django image: 52north/geonode:local + build: + context: ./ + dockerfile: Dockerfile restart: unless-stopped env_file: - .env_test @@ -23,9 +26,6 @@ services: # Our custom django application. It includes Geonode. django: << : *default-common-django - build: - context: ./ - dockerfile: Dockerfile container_name: django4${COMPOSE_PROJECT_NAME} healthcheck: test: "curl -m 10 --fail --silent --write-out 'HTTP CODE : %{http_code}\n' --output /dev/null http://django:8000/" diff --git a/docker-compose.yml b/docker-compose.yml index 0006630c92e..972c259e4d7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3.9' # Common Django template for GeoNode and Celery services below x-common-django: &default-common-django - image: 52north/geonode:4.2.x + image: 52north/geonode:4.2.4 restart: unless-stopped env_file: - .env @@ -114,7 +114,7 @@ services: condition: service_healthy data-dir-conf: - image: geonode/geoserver_data:2.24.2-v1 + image: geonode/geoserver_data:2.24.2-v2 container_name: gsconf4${COMPOSE_PROJECT_NAME} entrypoint: sleep infinity volumes: diff --git a/geonode/__init__.py b/geonode/__init__.py index 08d6c164079..256f61ef1db 100644 --- a/geonode/__init__.py +++ b/geonode/__init__.py @@ -19,7 +19,7 @@ import os -__version__ = (4, 2, 3, "final", 0) +__version__ = (4, 2, 4, "final", 0) default_app_config = "geonode.apps.AppConfig" diff --git a/geonode/base/api/tests.py b/geonode/base/api/tests.py index bbff21b3267..94dae413cd5 100644 --- a/geonode/base/api/tests.py +++ b/geonode/base/api/tests.py @@ -1951,10 +1951,10 @@ def test_set_resource_thumbnail(self): self.assertEqual(response.json(), "The url must be of an image with format (png, jpeg or jpg)") # using Base64 data as an ASCII byte string - data["file"] = ( - "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABHNCSVQICAgI\ + data[ + "file" + ] = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABHNCSVQICAgI\ fAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAANSURBVAiZYzAxMfkPAALYAZzx61+bAAAAAElFTkSuQmCC" - ) with patch("geonode.base.models.is_monochromatic_image") as _mck: _mck.return_value = False response = self.client.put(url, data=data, format="json") diff --git a/geonode/base/api/views.py b/geonode/base/api/views.py index 6132b54a412..31891c6ad14 100644 --- a/geonode/base/api/views.py +++ b/geonode/base/api/views.py @@ -1493,7 +1493,6 @@ def linked_resources(self, request, pk, *args, **kwargs): def base_linked_resources(instance, user, params): - try: resource_type = params.get("resource_type") link_type = params.get("link_type") diff --git a/geonode/base/models.py b/geonode/base/models.py index 5768df93281..c75918c755e 100644 --- a/geonode/base/models.py +++ b/geonode/base/models.py @@ -1707,8 +1707,7 @@ def set_contact_roles_from_metadata_edit(self, resource_base_form) -> bool: failed = False for role in self.get_multivalue_role_property_names(): try: - if resource_base_form.cleaned_data[role].exists(): - self.__setattr__(role, resource_base_form.cleaned_data[role]) + self.__setattr__(role, resource_base_form.cleaned_data[role]) except AttributeError: logger.warning(f"unable to set contact role {role} for {self} ...") failed = True @@ -1753,9 +1752,13 @@ def __create_role__( ContactRole.objects.filter(role=role, resource=self).delete() return __create_role__(self, role, user_profile) - elif isinstance(user_profile, list) and all(isinstance(x, get_user_model()) for x in user_profile): + elif isinstance(user_profile, list) and all( + get_user_model().objects.filter(username=x).exists() for x in user_profile + ): ContactRole.objects.filter(role=role, resource=self).delete() - return [__create_role__(self, role, profile) for profile in user_profile] + return [ + __create_role__(self, role, user) for user in get_user_model().objects.filter(username__in=user_profile) + ] elif user_profile is None: ContactRole.objects.filter(role=role, resource=self).delete() diff --git a/geonode/base/widgets.py b/geonode/base/widgets.py index b1281de7dd7..a4e32bb94d4 100644 --- a/geonode/base/widgets.py +++ b/geonode/base/widgets.py @@ -1,6 +1,7 @@ from typing import List from dal_select2_taggit.widgets import TaggitSelect2 +from django.http.request import QueryDict class TaggitSelect2Custom(TaggitSelect2): @@ -32,9 +33,8 @@ def value_from_datadict(self, data, files, name) -> List[str]: returns list of selected elements """ - try: - ret_list = data[name] - except KeyError: - ret_list = [] - finally: - return ret_list + if type(data) is dict and name in data: + return data[name] + elif type(data) is QueryDict: + return data.getlist(name) + return [] diff --git a/geonode/documents/templates/layouts/doc_panels.html b/geonode/documents/templates/layouts/doc_panels.html index d354531d314..c6eebcb6723 100644 --- a/geonode/documents/templates/layouts/doc_panels.html +++ b/geonode/documents/templates/layouts/doc_panels.html @@ -596,22 +596,6 @@ {% endblock document_more_contact_roles %} - -