Skip to content

Commit

Permalink
Merge tag '4.2.4' into 52n-4.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ridoo committed May 24, 2024
2 parents 052834a + e45d32b commit 3e178b7
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 39 deletions.
6 changes: 3 additions & 3 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/"
Expand Down
6 changes: 3 additions & 3 deletions docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/"
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion geonode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import os

__version__ = (4, 2, 3, "final", 0)
__version__ = (4, 2, 4, "final", 0)


default_app_config = "geonode.apps.AppConfig"
Expand Down
6 changes: 3 additions & 3 deletions geonode/base/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion geonode/base/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
11 changes: 7 additions & 4 deletions geonode/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
12 changes: 6 additions & 6 deletions geonode/base/widgets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import List

from dal_select2_taggit.widgets import TaggitSelect2
from django.http.request import QueryDict


class TaggitSelect2Custom(TaggitSelect2):
Expand Down Expand Up @@ -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 []
16 changes: 0 additions & 16 deletions geonode/documents/templates/layouts/doc_panels.html
Original file line number Diff line number Diff line change
Expand Up @@ -596,22 +596,6 @@
</div>
</div>
{% endblock document_more_contact_roles %}

<div class="panel panel-default">
<div class="panel-heading">{% trans "Responsible and Permissions" %}</div>
<div class="panel-body">
<div>
<span><label for="{{ document_form.owner|id }}">{{ document_form.owner.label }}</label></span>
<!--<p class="xxs-font-size">(Responsible of the cited resource)</p>-->
{{ document_form.owner }}
</div>
<div>
<span><label for="{{ document_form.metadata_author|id }}">{{ document_form.metadata_author.label }}</label></span>
<!--<p class="xxs-font-size">(Author of the metadata)</p>-->
{{ document_form.metadata_author }}
</div>
</div>
</div>
<!--End Contact Roles -->
</div>
</div>
Expand Down

0 comments on commit 3e178b7

Please sign in to comment.