Restore post of data in case of geo-error
@@ -216,8 +216,8 @@ class SearchAPI(APIView):
author = str(result.author)
if authors == 'None':
authors = author # author would override creator in
- else:
- if result.organization:
+
+ elif result.organization:
if isinstance(result.organization, list):
author = str(result.organization[0])
else:
@@ -231,16 +231,11 @@ class SearchAPI(APIView):
authors = author
if result.contributor is not None:
- try:
contributor = result.contributor
- except:
- pass
if result.owner is not None:
- try:
owner = result.owner
- except:
- pass
+
pt = '' # pass empty string for the frontend to ensure the attribute exists but can be evaluated for empty
try:
if 'box' in result.coverage_type:
@@ -262,6 +257,9 @@ class SearchAPI(APIView):
pt['westlimit'] = result.westlimit
geodata.append(pt)
+ except:
+ pass # HydroShare production contains dirty data, this handling is in place, until data cleaned
+
resources.append({
"title": result.title,
"link": result.absolute_url,
@@ -280,8 +278,6 @@ class SearchAPI(APIView):
"short_id": result.short_id,
"geo": pt
})
- except:
- pass # HydroShare production contains dirty data, this handling is in place, until data cleaned
return JsonResponse({
'resources': json.dumps(resources),
