Use inbox label as default author ID in auto-curate #64

Merged
cmo merged 1 commit from issue-54 into master 2026-10-15 03:18:22 +00:00

View file

@ -112,7 +112,7 @@ stl_info = False
)
@click.option(
'--add-annotations',
help='add annotations when posting a change set via `--post-change-set`. By default the annotations will not be added to the records that are posted. If --post-change-set is not provided, this flag is ignored',
help='add annotations when posting a change set via `--post-change-set`. By default the annotations will not be added to the records that are posted. If --post-change-set is not provided, this flag is ignored.',
default=False,
is_flag=True,
)
@ -120,22 +120,22 @@ stl_info = False
'--author_id',
metavar='AUTHOR_ID',
default=None,
help='specify an author ID that will be stored in the audit log (AUTHOR_ID must not contain whitespace).',
help='overwrite the default author ID with AUTHOR_ID (AUTHOR_ID must not contain whitespace).',
)
@click.option(
'--pid', '-p',
metavar='PID',
help='if provided, process only records that match the given PIDs. NOTE: matching does not involve CURIE-resolution',
help='if provided, process only records that match the given PIDs. NOTE: matching does not involve CURIE-resolution.',
)
@click.option(
'--list-labels', '-l',
help='list the inbox labels of the given source collection, do not perform any curation',
help='list the inbox labels of the given source collection, do not perform any curation.',
default=False,
is_flag=True,
)
@click.option(
'--list-records', '-r',
help='list records in the given inboxes, do not perform any curation',
help='list records in the given inboxes, do not perform any curation.',
default=False,
is_flag=True,
)
@ -164,7 +164,7 @@ stl_info = False
)
@click.option(
'--dry-run', '-d',
help='if provided, do not alter any data, instead print what would be done',
help='if provided, do not alter any data, instead print what would be done.',
default=False,
is_flag=True,
)
@ -355,6 +355,7 @@ def auto_curate(
else:
console.print(f'[yellow]Warning[/yellow]: inbox `{label}` not in collection.')
author_id = author_id or label
# Get the records from the service, or from a change set that should
# be posted.
if post_change_set:
@ -515,7 +516,7 @@ def _curate_records(
continue
if dry_run:
console.print(f'[DRY_RUN]:WRITE record [green]"{record["pid"]}"[/green] of class "{class_name}" to collection "{destination_collection}" on "{destination_service_url}"')
console.print(f'[DRY_RUN]:WRITE record [green]"{record["pid"]}"[/green] of class "{class_name}" to collection "{destination_collection}" on "{destination_service_url}" with author_id "{author_id}"')
else:
# Store record in destination collection
try:
@ -787,7 +788,7 @@ def _post_change_set(
continue
if dry_run:
console.print(f'[DRY_RUN]:WRITE record [green]"{record["pid"]}"[/green] of class "{class_name}" to collection "{destination_collection}" on "{destination_service_url}"')
console.print(f'[DRY_RUN]:WRITE record [green]"{record["pid"]}"[/green] of class "{class_name}" to collection "{destination_collection}" on "{destination_service_url}" with author_id "{author_id}"')
continue
# Store record in destination collection