Open JeneeW opened 2 months ago
Some possibly relevant information.
The error with more context:
web-1 | Traceback (most recent call last):
web-1 | File "/home/openlibrary/.local/lib/python3.12/site-packages/web/utils.py", line 101, in __getattr__
web-1 | return self[key]
web-1 | ~~~~^^^^^
web-1 | KeyError: 'edition_count'
web-1 |
web-1 | During handling of the above exception, another exception occurred:
web-1 |
web-1 | Traceback (most recent call last):
web-1 | File "/openlibrary/infogami/utils/template.py", line 156, in saferender
web-1 | result = t(*a, **kw)
web-1 | ^^^^^^^^^^^
web-1 | File "/home/openlibrary/.local/lib/python3.12/site-packages/web/template.py", line 991, in __call__
web-1 | return BaseTemplate.__call__(self, *a, **kw)
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/home/openlibrary/.local/lib/python3.12/site-packages/web/template.py", line 884, in __call__
web-1 | return self.t(*a, **kw)
web-1 | ^^^^^^^^^^^^^^^^
web-1 | File "/openlibrary/openlibrary/templates/books/check.html", line 36, in __template__
web-1 | </span>
web-1 |
web-1 | File "/home/openlibrary/.local/lib/python3.12/site-packages/web/utils.py", line 103, in __getattr__
web-1 | raise AttributeError(k)
web-1 | AttributeError: 'edition_count'
One of the matches openlibrary/templates/books/check.html
is trying to display is an edition, which seems an issue, as it lacks an edition_count
, and the template appears to contemplate displaying works:
<Storage {'key': '/books/OL50624231M', 'type': 'edition', 'title': 'Can Light Slice Through Steel?', 'title_suggest': 'Can Light Slice Through Steel?', 'title_sort': 'Can Light Slice Through Steel?', 'subtitle': 'And Other Questions About Machines', 'language': ['eng'], 'author_name': ['Clive Gifford'], 'author_key': ['OL23558A'], 'author_alternative_name': ['CLIVE GIFFORD', 'Clive Gifford David Cousens', 'Clive Gifford (author)', 'Clive GIFFORD', 'Clive. Gifford', 'Gifford Clive', 'Clive Gifford, Andrea Mills, Tracey Turner', "Clive Gifford, Conrad Mason, Cynthia O'brien, Helen Varley", 'Mr Clive Gifford'], 'publisher': ["Hachette Children's Group"], 'publish_date': ['2024'], 'publish_year': [2024], 'isbn': ['9781526320100', '152632010X'], 'ebook_access': 'no_ebook', 'has_fulltext': False, 'public_scan_b': False, 'publisher_facet': ["Hachette Children's Group"], '_version_': 1811310090626531328, 'author_facet': ['OL23558A Clive Gifford'], 'authors': [<Author: '/authors/OL23558A'>], 'cover_url': '/images/icons/avatar_book-sm.png', 'ia': [], 'first_publish_year': None}>
One question is whether this page, check.html
, works at all, even if display of work.edition_count
is guarded by a conditional such as $if work.type == "work"
.
Problem
I've come across a book that has two other titles listed as editions (A Question of Technology), and I've been instructed to create a new book and then move the editions into the new entry. Unfortunately when trying to do this I have repeatedly received an error message.
Does anyone have any ideas or a potential solution?
Breakdown
copydocs.py
to copy/works/OL26519179W
into the local development environment for testing. Ensure all the editions associated with this work are copied in as well (i.e. copy them withcopydocs.py
too if necessary). See https://github.com/internetarchive/openlibrary/wiki/Loading-Production-Book-Data for more.$if work.type == "work"
before the call towork.edition_count
here: https://github.com/internetarchive/openlibrary/blob/634240c790734f3a014ca783570e5d68995f9b24/openlibrary/templates/books/check.html#L32, and then trying to import the book as shown in the screenshot. What happens by trying to match a work versus edition?check.html
to see what is meant to be happening.