From 43e16d980c6b37102ae4da306c3e563ba9d501c0 Mon Sep 17 00:00:00 2001 From: amorev Date: Wed, 20 Sep 2023 15:26:51 +0300 Subject: [PATCH 1/2] SXDEDPCXZIC-193 / fix attribute error --- ckanext/datavic_harvester/harvesters/delwp.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ckanext/datavic_harvester/harvesters/delwp.py b/ckanext/datavic_harvester/harvesters/delwp.py index 86e7413..6621556 100644 --- a/ckanext/datavic_harvester/harvesters/delwp.py +++ b/ckanext/datavic_harvester/harvesters/delwp.py @@ -342,6 +342,8 @@ def _get_pkg_dict(self, harvest_object): metashare_dict["_uuid"] = uuid remote_pkg_name: Optional[str] = metashare_dict.get("name") + remote_topiccat: Optional[str] = metashare_dict.get("topiccat") + remote_resowner: Optional[str] = metashare_dict.get("resowner") full_metadata_url = ( self.config["full_metadata_url_prefix"].format(**{"UUID": uuid}) @@ -360,12 +362,12 @@ def _get_pkg_dict(self, harvest_object): pkg_dict["title"] = metashare_dict.get("title") pkg_dict["notes"] = metashare_dict.get("abstract", "") - pkg_dict["tags"] = helpers.get_tags(metashare_dict.get("topiccat")) + pkg_dict["tags"] = helpers.get_tags(remote_topiccat) if remote_topiccat else "" pkg_dict["last_updated"] = metashare_dict.get("geonet_info_changedate") pkg_dict["extract"] = f"{pkg_dict['notes'].split('.')[0]}..." pkg_dict["owner_org"] = self._get_organisation( self.config.get("organisation_mapping"), - metashare_dict.get("resowner").split(";")[0], + remote_resowner.split(";")[0] if remote_resowner else "", harvest_object, ) From 4420b1b88fe960cc55a6da3b6adae8bb6db8fe39 Mon Sep 17 00:00:00 2001 From: amorev Date: Thu, 21 Sep 2023 19:05:02 +0300 Subject: [PATCH 2/2] SXDEDPCXZIC-193 / fix getting remote tags --- ckanext/datavic_harvester/harvesters/delwp.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ckanext/datavic_harvester/harvesters/delwp.py b/ckanext/datavic_harvester/harvesters/delwp.py index 6621556..500d586 100644 --- a/ckanext/datavic_harvester/harvesters/delwp.py +++ b/ckanext/datavic_harvester/harvesters/delwp.py @@ -343,7 +343,6 @@ def _get_pkg_dict(self, harvest_object): remote_pkg_name: Optional[str] = metashare_dict.get("name") remote_topiccat: Optional[str] = metashare_dict.get("topiccat") - remote_resowner: Optional[str] = metashare_dict.get("resowner") full_metadata_url = ( self.config["full_metadata_url_prefix"].format(**{"UUID": uuid}) @@ -362,12 +361,12 @@ def _get_pkg_dict(self, harvest_object): pkg_dict["title"] = metashare_dict.get("title") pkg_dict["notes"] = metashare_dict.get("abstract", "") - pkg_dict["tags"] = helpers.get_tags(remote_topiccat) if remote_topiccat else "" + pkg_dict["tags"] = helpers.get_tags(remote_topiccat) if remote_topiccat else [] pkg_dict["last_updated"] = metashare_dict.get("geonet_info_changedate") pkg_dict["extract"] = f"{pkg_dict['notes'].split('.')[0]}..." pkg_dict["owner_org"] = self._get_organisation( self.config.get("organisation_mapping"), - remote_resowner.split(";")[0] if remote_resowner else "", + metashare_dict.get("resowner", "").split(";")[0], harvest_object, )