diff --git a/openlibrary/i18n/messages.pot b/openlibrary/i18n/messages.pot index 95ec39e0aad8..cdf6f6bcd024 100644 --- a/openlibrary/i18n/messages.pot +++ b/openlibrary/i18n/messages.pot @@ -3528,6 +3528,18 @@ msgstr "" msgid "Links" msgstr "" +#: books/edit.html +msgid "Work Identifiers" +msgstr "" + +#: books/edit.html +msgid "Do you know any identifiers for this work?" +msgstr "" + +#: books/edit.html +msgid "Like, Wikidata?" +msgstr "" + #: FulltextSearchSuggestionItem.html IABook.html SearchResultsWork.html #: books/edition-sort.html jsdef/LazyWorkPreview.html lists/list_overview.html #: lists/preview.html lists/snippet.html lists/widget.html diff --git a/openlibrary/plugins/upstream/models.py b/openlibrary/plugins/upstream/models.py index 99dddc159049..4a646e4be3f2 100644 --- a/openlibrary/plugins/upstream/models.py +++ b/openlibrary/plugins/upstream/models.py @@ -18,7 +18,11 @@ borrow, ) from openlibrary.plugins.upstream.table_of_contents import TableOfContents -from openlibrary.plugins.upstream.utils import MultiDict, get_edition_config, get_work_config +from openlibrary.plugins.upstream.utils import ( + MultiDict, + get_edition_config, + get_work_config, +) from openlibrary.plugins.worksearch.code import works_by_author from openlibrary.plugins.worksearch.search import get_solr from openlibrary.utils import dateutil # noqa: F401 side effects may be needed @@ -789,7 +793,9 @@ def process(name, value): if not isinstance(value, list): value = [value] - id = id_map.get(name) or web.storage(name=name, label=name, url_format=None) + id = id_map.get(name) or web.storage( + name=name, label=name, url_format=None + ) for v in value: d[id.name] = web.storage( name=id.name, @@ -797,6 +803,7 @@ def process(name, value): value=v, url=id.get('url') and id.url.replace('@@@', v.replace(' ', '')), ) + for name in names: process(name, self[name]) @@ -805,6 +812,7 @@ def process(name, value): return d + class Subject(client.Thing): pass diff --git a/openlibrary/plugins/upstream/utils.py b/openlibrary/plugins/upstream/utils.py index 937044a4d282..875da50076af 100644 --- a/openlibrary/plugins/upstream/utils.py +++ b/openlibrary/plugins/upstream/utils.py @@ -1218,19 +1218,19 @@ def _get_edition_config(): classifications=classifications, identifiers=identifiers, roles=roles ) + @public def get_work_config() -> Storage: return _get_work_config() + @web.memoize def _get_work_config() -> Storage: """ Pulls the list of all work identifiers from the identifiers.yml file and inserts them into a Storage object? """ - with open( - 'openlibrary/plugins/openlibrary/config/work/identifiers.yml' - ) as in_file: + with open('openlibrary/plugins/openlibrary/config/work/identifiers.yml') as in_file: id_config = yaml.safe_load(in_file) identifiers = [ Storage(id) for id in id_config.get('identifiers', []) if 'name' in id