From 704715d53537d4fcda5111d01a9ba278e67e003c Mon Sep 17 00:00:00 2001 From: "Morten W. Hansen" Date: Fri, 14 Aug 2020 11:29:29 +0200 Subject: [PATCH] GH-128: removed obsolete comments --- geospaas/nansat_ingestor/managers.py | 10 +++------- geospaas/nansat_ingestor/tests.py | 5 ----- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/geospaas/nansat_ingestor/managers.py b/geospaas/nansat_ingestor/managers.py index 87376662..c03efb5c 100644 --- a/geospaas/nansat_ingestor/managers.py +++ b/geospaas/nansat_ingestor/managers.py @@ -86,10 +86,6 @@ def get_or_create(self, options = {} try: existing_ds = Dataset.objects.get(entry_id=entry_id) - # Since the entry_id should be unique, it would be a rather serious issue if multiple objects - # are returned here. I suggest to remove the exception Dataset.MultipleObjectsReturned to - # catch such a theoretical error.. - #except (Dataset.DoesNotExist, Dataset.MultipleObjectsReturned): except Dataset.DoesNotExist: existing_ds = None for name in default_char_fields: @@ -136,9 +132,9 @@ def get_or_create(self, geometry=WKTReader().read(n.get_border_wkt(nPoints=n_points)))[0] # create dataset - # - the get_or_create method should use get_or_create here as well - see issue #127 - # - also read entry_id from options dict - ds, created = Dataset.objects.get_or_create(entry_id=options['entry_id'], defaults={ + # - the get_or_create method should use get_or_create here as well, + # or its name should be changed - see issue #127 + ds, created = Dataset.objects.update_or_create(entry_id=options['entry_id'], defaults={ 'time_coverage_start': n.get_metadata('time_coverage_start'), 'time_coverage_end': n.get_metadata('time_coverage_end'), 'source': source, diff --git a/geospaas/nansat_ingestor/tests.py b/geospaas/nansat_ingestor/tests.py index 37f2c412..10807255 100644 --- a/geospaas/nansat_ingestor/tests.py +++ b/geospaas/nansat_ingestor/tests.py @@ -30,11 +30,6 @@ class BasetForTests(TestCase): """Base class for creating the testing environment""" fixtures = ['vocabularies', 'catalog'] predefined_metadata_dict = { - # In development, it does not necessarily make sense to provide the entry_id from metadata. - # Also, Nansat should not set the entry_id, as this would then be different each time a new - # Nansat instance is created (provided uuid is used). I propose to remove it from this dict, - # and test both with and without the enty_id. - #'entry_id': 'UNIQUE_ID_1000', 'platform': '{"Category": "Earth Observation Satellites", "Series_Entity": "", "Short_Name": "ENVISAT", "Long_Name": "Environmental Satellite"}', 'instrument': '{"Category": "Earth Remote Sensing Instruments", "Class": "Passive Remote Sensing", "Type": "Spectrometers/Radiometers", "Subtype": "Imaging Spectrometers/Radiometers", "Short_Name": "MERIS", "Long_Name": "Medium Resolution Imaging Spectrometer"}', 'time_coverage_start': '2011-05-03T10:56:38.995099',