Skip to content

Commit

Permalink
Modify the code to add the full URL for DOI in related_resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
NTaherifar committed Jun 6, 2024
1 parent 722f439 commit 4832d9e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ckan/src/ckanext-igsn-theme/ckanext/igsn_theme/logic/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def organization_list_for_user(next_action, context, data_dict):

@tk.chained_action
def package_create(next_action, context, data_dict):
# logger = logging.getLogger(__name__)
# logger.info("data_dict: %s", pformat(data_dict))
logger = logging.getLogger(__name__)
logger.info("package_create data_dict: %s", pformat(data_dict))

package_type = data_dict.get('type')
package_plugin = lib_plugins.lookup_package_plugin(package_type)
Expand Down Expand Up @@ -87,10 +87,15 @@ def generate_parent_related_resource(data_dict):
new_index = highest_index + 1

data_dict[f'related_resource-{new_index}-related_resource_type'] = "PhysicalObject"
data_dict[f'related_resource-{new_index}-related_resource_url'] = parent.get('doi')
data_dict[f'related_resource-{new_index}-related_resource_title'] = parent.get('title')
data_dict[f'related_resource-{new_index}-relation_type'] = "IsDerivedFrom"

doi_value = parent.get('doi')
if doi_value:
if 'https' not in doi_value:
doi_value = "https://doi.org/" + doi_value
data_dict[f'related_resource-{new_index}-related_resource_url'] = doi_value

# We do not need user_create customization here.
# Users do not need to be a part of an organization by default.
@tk.chained_action
Expand Down

0 comments on commit 4832d9e

Please sign in to comment.