-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add post-processing plugin for InvenioRDM
This might have been parametrized or implemented differently to distinguish between Invenio and InvenioRDM. However, this way works without further coding headache...
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# SPDX-FileCopyrightText: 2023 German Aerospace Center (DLR) | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# SPDX-FileContributor: Michael Meinel | ||
# SPDX-FileContributor: Stephan Druskat | ||
|
||
import json | ||
import logging | ||
|
||
import toml | ||
from ruamel import yaml | ||
|
||
from hermes import config | ||
|
||
|
||
_log = logging.getLogger('deposit.invenio_rdm') | ||
|
||
|
||
def config_record_id(ctx): | ||
deposition_path = ctx.get_cache('deposit', 'deposit') | ||
with deposition_path.open("r") as deposition_file: | ||
deposition = json.load(deposition_file) | ||
conf = config.get('hermes') | ||
try: | ||
conf['deposit']['invenio_rdm']['record_id'] = deposition['record_id'] | ||
toml.dump(conf, open('hermes.toml', 'w')) | ||
except KeyError: | ||
raise RuntimeError("No deposit.invenio configuration available to store record id in") from None |