Example #1
0
 def finalize_resource_update(
         self, geonode_resource: ResourceBase,
         harvested_info: base.HarvestedResourceInfo,
         harvestable_resource: models.HarvestableResource,
         harvesting_session_id: int) -> ResourceBase:
     is_document = (harvestable_resource.remote_resource_type ==
                    GeoNodeResourceType.DOCUMENT.value)
     if is_document:
         geonode_resource.thumbnail_url = (
             harvested_info.resource_descriptor.distribution.thumbnail_url)
         geonode_resource.doc_url = (harvested_info.resource_descriptor.
                                     distribution.original_format_url)
     geonode_resource.save()
     return geonode_resource
Example #2
0
 def finalize_resource_update(
         self, geonode_resource: ResourceBase,
         harvested_info: base.HarvestedResourceInfo,
         harvestable_resource: harvesting_models.HarvestableResource,
         harvesting_session_id: int) -> ResourceBase:
     if harvestable_resource.remote_resource_type != PdnResourceType.DOCUMENT.value:
         raise RuntimeError(
             f"Unexpected resource type: {harvestable_resource.remote_resource_type}"
         )
     else:
         geonode_resource.thumbnail_url = harvested_info.resource_descriptor.distribution.thumbnail_url
         geonode_resource.doc_url = harvested_info.resource_descriptor.distribution.original_format_url
         geonode_resource.save()
     return geonode_resource