Skip to content

Commit

Permalink
fix: compatibility_mode issue
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasianayden committed Apr 18, 2024
1 parent 9e58c34 commit c8a11f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions ckanext/fairdatapoint/harvesters/civity_harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def import_stage(self, harvest_object):
# Get the last harvested object (if any)
previous_object = model.Session.query(HarvestObject) \
.filter(HarvestObject.guid == harvest_object.guid) \
.filter(HarvestObject.current == True) \
.filter(HarvestObject.current is True) \
.first()

# Flag previous object as not current anymore
Expand Down Expand Up @@ -394,7 +394,7 @@ def _create_or_update_package(self, package_dict, create_or_update, context, har
return result

def _create_resources(self, resource_dicts, package_id, package_title, context, harvest_object):
result = True;
result = True

for resource_dict in resource_dicts:
if 'id' in resource_dict.keys():
Expand Down Expand Up @@ -427,7 +427,7 @@ def _get_guids_to_package_ids_from_database(harvest_job):
:return:
"""
query = model.Session.query(HarvestObject.guid, HarvestObject.package_id). \
filter(HarvestObject.current == True). \
filter(HarvestObject.current is True). \
filter(HarvestObject.harvest_source_id == harvest_job.source.id)

guid_to_package_id = {}
Expand Down
6 changes: 5 additions & 1 deletion ckanext/fairdatapoint/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from ckan import model
import dateutil.parser as dateparser
from dateutil.parser import ParserError
from json import JSONDecodeError
from typing import Dict, List
from rdflib import URIRef

Expand Down Expand Up @@ -43,7 +44,10 @@ def _convert_extras_to_declared_schema_fields(dataset_dict: Dict) -> Dict:
if field_key in dataset_fields:
preset = dataset_fields[field_key]
if preset == 'multiple_text' and field_value:
dataset_dict[field_key] = json.loads(field_value)
try:
dataset_dict[field_key] = json.loads(field_value)
except JSONDecodeError:
dataset_dict[field_key] = field_value
elif preset == 'date' and field_value:
dataset_dict[field_key] = convert_datetime_string(field_value)
else:
Expand Down

0 comments on commit c8a11f8

Please sign in to comment.