-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Lines 130 to 136 in 9ccf05b
| data = {"doi": work.get("doi"), | |
| "author": work.get("copyrightHolder"), | |
| "title": work.get("fullTitle"), | |
| "publisher": work.get("imprint", {}).get("imprintName"), | |
| "abstract": work.get("longAbstract"), | |
| "pages": work.get("pageInterval"), | |
| "licence": work.get("license")} |
The use of .get() here, rather than accessing elements by key (e.g. work['doi']), means that any field where the requested value is not present will be set to None. Many of the values being requested are not mandatory in Thoth, so they may have been left empty and we won't notice - which could mean that later in the process (write_metadata()), the corresponding PDF metadata is left unset.
Accessing the elements by key instead would cause the program to crash if any of these values was not found. This could be preferable if we want to avoid writing incomplete metadata. (We could obviously refine this by handling the crash and raising a better error.)
I think at the moment the only missing value which causes an actual error is pageInterval - see #13.