Skip to content

Commit

Permalink
[Fixes #10537] Improve rules creation using GeoFence batch (#10538)
Browse files Browse the repository at this point in the history
* [Fixes #10537] Improve rules creation using GeoFence batch

* - code improvements accordingly to the PR comments

* - code improvements accordingly to the PR comments

* - Test fixes

Co-authored-by: afabiani <alessio.fabiani@geosolutionsgroup.com>
(cherry picked from commit d101ead)
  • Loading branch information
etj authored and github-actions[bot] committed Jan 23, 2023
1 parent d2c30a2 commit 49818eb
Show file tree
Hide file tree
Showing 8 changed files with 505 additions and 321 deletions.
6 changes: 3 additions & 3 deletions geonode/base/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ def test_base_resources(self):
self.assertEqual(len(response.data), 5)
self.assertEqual(response.data['total'], 28)

url = "{base_url}?{params}".format(base_url=reverse('base-resources-list'), params="filter{metadata_only}=false")
url = f"{reverse('base-resources-list')}?filter{{metadata_only}}=false"
# Anonymous
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, 200)
Expand Down Expand Up @@ -558,7 +558,7 @@ def test_base_resources(self):
resource = ResourceBase.objects.filter(owner__username='bobby').first()
self.assertEqual(resource.owner.username, 'bobby')
# Admin
url_with_id = "{base_url}/{res_id}?{params}".format(base_url=reverse('base-resources-list'), res_id=resource.id, params="filter{metadata_only}=false")
url_with_id = f"{reverse('base-resources-list')}/{resource.id}?filter{{metadata_only}}=false"

response = self.client.get(f"{url_with_id}", format='json')
self.assertEqual(response.data['resource']['state'], enumerations.STATE_PROCESSED)
Expand Down Expand Up @@ -1718,7 +1718,7 @@ def test_embed_urls(self):

resources = ResourceBase.objects.all()
for resource in resources:
url = "{base_url}?{params}".format(base_url=reverse('base-resources-detail', kwargs={'pk': resource.pk}), params="filter{metadata_only}=false")
url = f"{reverse('base-resources-detail', kwargs={'pk': resource.pk})}?filter{{metadata_only}}=false"
response = self.client.get(url, format='json')
if resource.title.endswith('metadata true'):
self.assertEqual(response.status_code, 404)
Expand Down
6 changes: 3 additions & 3 deletions geonode/br/management/commands/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,17 @@ def execute_restore(self, **options):
chmod_tree(static_root)
for static_files_folder in static_folders:
if getattr(settings, 'PROJECT_ROOT', None) and \
static_files_folder.startswith(settings.PROJECT_ROOT):
static_files_folder.startswith(settings.PROJECT_ROOT):
print(f"[Sanity Check] Full Write Access to '{static_files_folder}' ...")
chmod_tree(static_files_folder)
for template_files_folder in template_folders:
if getattr(settings, 'PROJECT_ROOT', None) and \
template_files_folder.startswith(settings.PROJECT_ROOT):
template_files_folder.startswith(settings.PROJECT_ROOT):
print(f"[Sanity Check] Full Write Access to '{template_files_folder}' ...")
chmod_tree(template_files_folder)
for locale_files_folder in locale_folders:
if getattr(settings, 'PROJECT_ROOT', None) and \
locale_files_folder.startswith(settings.PROJECT_ROOT):
locale_files_folder.startswith(settings.PROJECT_ROOT):
print(f"[Sanity Check] Full Write Access to '{locale_files_folder}' ...")
chmod_tree(locale_files_folder)
except Exception as exception:
Expand Down
Loading

0 comments on commit 49818eb

Please sign in to comment.