Skip to content

Commit e63c6ab

Browse files
authored
Merge branch 'master' into master
2 parents 6c8d232 + b73cc24 commit e63c6ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+11
-183
lines changed

geonode/api/resourcebase_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ def get_search(self, request, **kwargs):
403403
sqs = self.build_haystack_filters(request.GET)
404404

405405
if not settings.SKIP_PERMS_FILTER:
406-
407406
filter_set = get_objects_for_user(request.user, "base.view_resourcebase")
408407

409408
filter_set = get_visible_resources(

geonode/api/tests.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ def test_dataset_get_detail_unauth_dataset_not_public(self):
160160
# with delayed security
161161
with self.settings(DELAYED_SECURITY_SIGNALS=True, GEOFENCE_SECURITY_ENABLED=True):
162162
if check_ogc_backend(geoserver.BACKEND_PACKAGE):
163-
164163
gm = GeoServerResourceManager()
165164
gm.set_permissions(layer.uuid, instance=layer, permissions=self.perm_spec)
166165
self.assertTrue(layer.dirty_state)
@@ -435,7 +434,6 @@ def test_groups_filters(self):
435434
"""Test groups filtering"""
436435

437436
with self.settings(API_LOCKDOWN=False):
438-
439437
filter_url = self.groups_list_url
440438

441439
resp = self.api_client.get(filter_url)

geonode/api/views.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ def user_info(request):
9797

9898
@csrf_exempt
9999
def verify_token(request):
100-
101100
if request.POST and "token" in request.POST:
102101
token = None
103102
try:

geonode/apps.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def run_setup_hooks(*args, **kwargs):
2828

2929

3030
class AppConfig(BaseAppConfig):
31-
3231
name = "geonode"
3332
label = "geonode"
3433

geonode/base/admin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ def keyword_id(self, obj):
338338

339339

340340
class ResourceBaseAdminForm(autocomplete.FutureModelForm):
341-
342341
keywords = TagField(widget=TaggitSelect2Custom("autocomplete_hierachical_keyword"))
343342

344343
def delete_queryset(self, request, queryset):

geonode/base/api/pagination.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727

2828
class GeoNodeApiPagination(PageNumberPagination):
29-
3029
page = DEFAULT_PAGE
3130
page_size = DEFAULT_PAGE_SIZE
3231
page_size_query_param = DEFAULT_PAGE_QUERY_PARAM

geonode/base/api/permissions.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ class ResourceBasePermissionsFilter(BaseFilterBackend):
200200
"""
201201

202202
def filter_queryset(self, request, queryset, view):
203-
204203
try:
205204
metadata_only = strtobool(request.query_params.get("filter{metadata_only}", "None"))
206205
except Exception:

geonode/base/api/serializers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ class Meta:
254254
fields = ("pk", "metadata")
255255

256256
def to_representation(self, obj):
257-
258257
if isinstance(obj, QuerySet):
259258
out = []
260259
for el in obj:

geonode/base/api/tests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272

7373

7474
class BaseApiTests(APITestCase):
75-
7675
fixtures = ["initial_data.json", "group_test_data.json", "default_oauth_apps.json", "test_thesaurus.json"]
7776

7877
def setUp(self):

geonode/base/api/views.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,6 @@ def resource_service_ingest(self, request, resource_type: str = None):
826826
):
827827
return Response(status=status.HTTP_403_FORBIDDEN)
828828
try:
829-
830829
request_params = self._get_request_params(request)
831830
uuid = request_params.get("uuid", str(uuid4()))
832831
resource_filter = ResourceBase.objects.filter(uuid=uuid)

geonode/base/forms.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ def render_option_value(self, selected_choices, option_value, option_label, data
170170
)
171171

172172
def render_options(self, selected_choices):
173-
174173
# Normalize to strings.
175174
def _region_id_from_choice(choice):
176175
if isinstance(choice, int) or (isinstance(choice, str) and choice.isdigit()):
@@ -260,7 +259,6 @@ class Meta:
260259

261260

262261
class ThesaurusAvailableForm(forms.Form):
263-
264262
# seperator at beginning of thesaurus search result and between
265263
# results found in local language and alt label
266264

@@ -311,7 +309,6 @@ def _define_choicefield(self, item, required, tname, lang):
311309

312310
@staticmethod
313311
def _get_thesauro_keyword_label(item, lang):
314-
315312
keyword_id_for_given_thesaurus = ThesaurusKeyword.objects.filter(thesaurus_id=item)
316313

317314
# try find results found for given language e.g. (en-us) if no results found remove country code from language to (en) and try again

geonode/base/middleware.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def __call__(self, request):
4747
return self.get_response(request)
4848

4949
def process_view(self, request, view_func, view_args, view_kwargs):
50-
5150
session = request.session
5251
configuration_session_cache(session)
5352

@@ -86,7 +85,6 @@ def __call__(self, request):
8685
return self.get_response(request)
8786

8887
def process_view(self, request, view_func, view_args, view_kwargs):
89-
9088
session = request.session
9189
configuration_session_cache(session)
9290

geonode/base/tests.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,6 @@ def test_read_only_casual_user_privileges(self):
514514
self.assertEqual(response.status_code, 405, "User is allowed to post to forbidden URL")
515515

516516
def test_maintenance_whitelist(self):
517-
518517
web_client = Client()
519518

520519
# set read-only flag
@@ -713,7 +712,6 @@ def test_converted_html_in_tags_with_with_multiple_tags(self):
713712

714713

715714
class TestTagThesaurus(TestCase):
716-
717715
# loading test thesausurs
718716
fixtures = ["test_thesaurus.json"]
719717

@@ -782,7 +780,6 @@ def __get_last_thesaurus():
782780

783781
@override_settings(THESAURUS_DEFAULT_LANG="en")
784782
class TestThesaurusAvailableForm(TestCase):
785-
786783
# loading test thesausurs
787784
fixtures = ["test_thesaurus.json"]
788785

@@ -956,7 +953,6 @@ def test_facets_filter_datasets_returns_correctly(self):
956953

957954

958955
class TestGenerateThesaurusReference(TestCase):
959-
960956
fixtures = ["test_thesaurus.json"]
961957

962958
def setUp(self):

geonode/base/views.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ def get_results(self, context):
327327

328328
class ThesaurusAvailable(autocomplete.Select2QuerySetView):
329329
def get_queryset(self):
330-
331330
tid = self.request.GET.get("sysid")
332331
lang = get_language()
333332
keyword_id_for_given_thesaurus = ThesaurusKeyword.objects.filter(thesaurus_id=tid)

geonode/br/tests/test_restore.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def setUp(self):
4040
# force restore interruption before starting the procedure itself
4141
@mock.patch("geonode.br.management.commands.utils.utils.confirm", return_value=False)
4242
def test_with_logs_success(self, fake_confirm):
43-
4443
# create the backup file
4544
with tempfile.NamedTemporaryFile() as tmp_file:
4645
with zipfile.ZipFile(tmp_file, "w", zipfile.ZIP_DEFLATED) as archive:
@@ -62,7 +61,6 @@ def test_with_logs_success(self, fake_confirm):
6261
# force restore interruption before starting the procedure itself
6362
@mock.patch("geonode.br.management.commands.utils.utils.confirm", return_value=False)
6463
def test_with_logs_failure(self, fake_confirm):
65-
6664
# create the backup file
6765
with tempfile.NamedTemporaryFile() as tmp_file:
6866
with zipfile.ZipFile(tmp_file, "w", zipfile.ZIP_DEFLATED) as archive:
@@ -93,7 +91,6 @@ def test_with_logs_failure(self, fake_confirm):
9391
# mock geonode.base.models.Configuration save() method
9492
@mock.patch("geonode.base.models.Configuration.save", return_value=None)
9593
def test_with_read_only_mode(self, mock_configuration_save, fake_confirm):
96-
9794
# create the backup file
9895
with tempfile.NamedTemporaryFile() as tmp_file:
9996
with zipfile.ZipFile(tmp_file, "w", zipfile.ZIP_DEFLATED) as archive:
@@ -117,7 +114,6 @@ def test_with_read_only_mode(self, mock_configuration_save, fake_confirm):
117114
# mock geonode.base.models.Configuration save() method
118115
@mock.patch("geonode.base.models.Configuration.save", return_value=None)
119116
def test_without_read_only_mode(self, mock_configuration_save, fake_confirm):
120-
121117
# create the backup file
122118
with tempfile.NamedTemporaryFile() as tmp_file:
123119
with zipfile.ZipFile(tmp_file, "w", zipfile.ZIP_DEFLATED) as archive:
@@ -141,7 +137,6 @@ def test_without_read_only_mode(self, mock_configuration_save, fake_confirm):
141137
# mock geonode.base.models.Configuration save() method
142138
@mock.patch("geonode.base.models.Configuration.save", return_value=None)
143139
def test_config_files(self, mock_configuration_save, fake_confirm):
144-
145140
# create the backup file
146141
with tempfile.NamedTemporaryFile() as tmp_file:
147142
with zipfile.ZipFile(tmp_file, "w", zipfile.ZIP_DEFLATED) as archive:

geonode/br/tests/test_restore_helpers.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class RestoreCommandHelpersTests(GeoNodeBaseTestSupport):
3636

3737
# validate_backup_file_options() method test
3838
def test_mandatory_option_failure(self):
39-
4039
options = {}
4140

4241
with self.assertRaises(CommandError) as exc:
@@ -46,7 +45,6 @@ def test_mandatory_option_failure(self):
4645

4746
# validate_backup_file_options() method test
4847
def test_exclusive_option_failure(self):
49-
5048
options = {"backup_file": "/some/random/path/1.zip", "backup_files_dir": "/some/random/path"}
5149

5250
with self.assertRaises(CommandError) as exc:
@@ -56,7 +54,6 @@ def test_exclusive_option_failure(self):
5654

5755
# validate_backup_file_options() method test
5856
def test_mandatory_option_backup_file_success(self):
59-
6057
with tempfile.NamedTemporaryFile() as tmp:
6158
with zipfile.ZipFile(tmp, "w", zipfile.ZIP_DEFLATED) as archive:
6259
archive.writestr("something.txt", "Some Content Here")
@@ -66,9 +63,7 @@ def test_mandatory_option_backup_file_success(self):
6663

6764
# validate_backup_file_options() method test
6865
def test_mandatory_option_backup_file_failure(self):
69-
7066
with tempfile.NamedTemporaryFile() as tmp:
71-
7267
options = {"backup_file": tmp.name}
7368

7469
with self.assertRaises(CommandError) as exc:
@@ -78,16 +73,13 @@ def test_mandatory_option_backup_file_failure(self):
7873

7974
# validate_backup_file_options() method test
8075
def test_mandatory_option_backup_files_dir_success(self):
81-
8276
with tempfile.TemporaryDirectory() as tmp:
8377
options = {"backup_files_dir": tmp}
8478
RestoreCommand().validate_backup_file_options(**options)
8579

8680
# validate_backup_file_options() method test
8781
def test_mandatory_option_backup_files_dir_failure(self):
88-
8982
with tempfile.NamedTemporaryFile() as tmp:
90-
9183
options = {"backup_files_dir": tmp.name}
9284

9385
with self.assertRaises(CommandError) as exc:
@@ -97,18 +89,14 @@ def test_mandatory_option_backup_files_dir_failure(self):
9789

9890
# parse_backup_files_dir() method test
9991
def test_backup_files_dir_no_archive(self):
100-
10192
with tempfile.TemporaryDirectory() as tmp:
102-
10393
backup_file = RestoreCommand().parse_backup_files_dir(tmp)
10494
self.assertIsNone(backup_file, "Expecting backup file to be None")
10595

10696
# parse_backup_files_dir() method test
10797
def test_backup_files_dir_multiple_archives(self):
108-
10998
# create a backup files directory
11099
with tempfile.TemporaryDirectory() as tmp_dir:
111-
112100
# create the 1st backup file
113101
with tempfile.NamedTemporaryFile(dir=tmp_dir) as tmp_file_1:
114102
with zipfile.ZipFile(tmp_file_1, "w", zipfile.ZIP_DEFLATED) as archive:
@@ -128,13 +116,11 @@ def test_backup_files_dir_multiple_archives(self):
128116

129117
# parse_backup_files_dir() method test
130118
def test_backup_files_dir_with_newer_restored_backup(self):
131-
132119
# create an entry in restoration history with a dump created in the future
133120
RestoredBackupFactory(creation_date=(datetime.datetime.now()) + datetime.timedelta(days=2))
134121

135122
# create a backup files directory
136123
with tempfile.TemporaryDirectory() as tmp_dir:
137-
138124
# create the backup file
139125
with tempfile.NamedTemporaryFile(dir=tmp_dir) as tmp_file:
140126
with zipfile.ZipFile(tmp_file, "w", zipfile.ZIP_DEFLATED) as archive:
@@ -146,13 +132,11 @@ def test_backup_files_dir_with_newer_restored_backup(self):
146132

147133
# parse_backup_files_dir() method test
148134
def test_backup_files_dir_with_older_restored_backup(self):
149-
150135
# create an entry in restoration history with a dump created in the past
151136
RestoredBackupFactory(creation_date=(datetime.datetime.now()) - datetime.timedelta(days=2))
152137

153138
# create a backup files directory
154139
with tempfile.TemporaryDirectory() as tmp_dir:
155-
156140
# create the backup file
157141
with tempfile.NamedTemporaryFile(dir=tmp_dir) as tmp_file:
158142
with zipfile.ZipFile(tmp_file, "w", zipfile.ZIP_DEFLATED) as archive:
@@ -164,7 +148,6 @@ def test_backup_files_dir_with_older_restored_backup(self):
164148

165149
# validate_backup_file_hash() method test
166150
def test_backup_hash_no_md5_file(self):
167-
168151
# create the backup file
169152
with tempfile.NamedTemporaryFile() as tmp_file:
170153
with zipfile.ZipFile(tmp_file, "w", zipfile.ZIP_DEFLATED) as archive:
@@ -176,7 +159,6 @@ def test_backup_hash_no_md5_file(self):
176159

177160
# validate_backup_file_hash() method test
178161
def test_backup_hash_failure(self):
179-
180162
# create the backup file
181163
with tempfile.NamedTemporaryFile() as tmp_file:
182164
with zipfile.ZipFile(tmp_file, "w", zipfile.ZIP_DEFLATED) as archive:
@@ -203,7 +185,6 @@ def test_backup_hash_failure(self):
203185

204186
# validate_backup_file_hash() method test
205187
def test_backup_hash_success(self):
206-
207188
# create the backup file
208189
with tempfile.NamedTemporaryFile() as tmp_file:
209190
with zipfile.ZipFile(tmp_file, "w", zipfile.ZIP_DEFLATED) as archive:

geonode/client/apps.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222

2323
class AppConfig(BaseAppConfig):
24-
2524
name = "geonode.client"
2625
label = "geonode_client"
2726
verbose_name = _("GeoNode Client Library")

geonode/client/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def is_installed(package):
4747

4848

4949
class GeoNodeClientAppConf(AppConf):
50-
5150
LAYER_PREVIEW_LIBRARY = "geonode"
5251
HOOKSET = "geonode.client.hooksets.BaseHookSet"
5352

geonode/client/hooksets.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121

2222
class BaseHookSet:
23-
2423
# Layers
2524
def dataset_list_template(self, context=None):
2625
return NotImplemented

geonode/documents/api/tests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636

3737
class DocumentsApiTests(APITestCase):
38-
3938
fixtures = ["initial_data.json", "group_test_data.json", "default_oauth_apps.json"]
4039

4140
def setUp(self):

geonode/documents/exif/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def convertExifLocationToDecimalDegrees(location, direction):
6363

6464

6565
def exif_extract_metadata_doc(doc):
66-
6766
if not doc:
6867
return None
6968

@@ -126,7 +125,6 @@ def exif_extract_metadata_doc(doc):
126125

127126

128127
def exif_build_abstract(model=None, date=None, lat=None, lon=None):
129-
130128
if model and date and lat and lon:
131129
return ABSTRACT_TEMPLATE_MODEL_DATE_LATLON.format(model=model, date=date, lat=lat, lon=lon)
132130
elif model and date:

geonode/documents/forms.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def _get_max_size(self):
8484

8585
class DocumentFormMixin:
8686
def generate_link_choices(self, resources=None):
87-
8887
if resources is None:
8988
resources = list(Dataset.objects.all())
9089
resources += list(Map.objects.all())
@@ -122,7 +121,6 @@ def save_many2many(self, links_field="links"):
122121

123122

124123
class DocumentForm(ResourceBaseForm, DocumentFormMixin):
125-
126124
title = forms.CharField(required=False)
127125

128126
links = forms.MultipleChoiceField(label=_("Link to"), required=False)

0 commit comments

Comments
 (0)