internetarchive / openlibrary

One webpage for every book ever published!
https://openlibrary.org
GNU Affero General Public License v3.0
5.26k stars 1.4k forks source link

Unable to submit new book #9914

Open JeneeW opened 2 months ago

JeneeW commented 2 months ago

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. Screenshot 2024-09-26 8 11 56 PM

Screenshot 2024-09-26 8 11 25 PM Does anyone have any ideas or a potential solution?

Breakdown

scottbarnes commented 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".