Skip to content

don't fetch author with cover aspect ratio #10795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025

Conversation

RayBB
Copy link
Collaborator

@RayBB RayBB commented May 16, 2025

Followup to #10776

See also: #10796

We were getting an error in some cases:


<class 'AssertionError'> at /books/OL32849056M
key account/ImportBot does not start with '/'
Python 	/openlibrary/infogami/infobase/client.py in get, line 324
Web 	GET http://testing.openlibrary.org/books/OL32849056M
Traceback (innermost first)

    /openlibrary/infogami/infobase/client.py in get
                assert key.startswith('/'), f"key {key} does not start with '/'" ...
    ▶ Local vars
    /openlibrary/openlibrary/core/models.py in info
                    d['author'] = d['author'] and self._site.get(d['author']) ...
    ▶ Local vars
    /openlibrary/openlibrary/core/models.py in get_aspect_ratio
                info = self.info() ...
    ▶ Local vars
    /openlibrary/openlibrary/plugins/upstream/models.py in get_cover_aspect_ratio
                    return cover.get_aspect_ratio() ...
    ▶ Local vars
    /openlibrary/openlibrary/templates/covers/book_cover.html in __template__
        $ cover_aspect_ratio = book.get_cover_aspect_ratio() ...
    ▶ Local vars
    /openlibrary/infogami/utils/template.py in saferender
                    result = t(*a, **kw) ...
    ▶ Local vars
    /openlibrary/infogami/utils/template.py in g
                    return f(*a, **kw) ...
    ▶ Local vars
    /openlibrary/infogami/utils/template.py in <lambda>
                    return lambda *a, **kw: saferender(templates, *a, **kw) ...
    ▶ Local vars
    /openlibrary/openlibrary/app.py in render_template
            return render[name](*a, **kw) ...
    ▶ Local vars
    /openlibrary/openlibrary/macros/databarWork.html in __template__
                  $:render_template('covers/book_cover', page, preload=True) ...
    ▶ Local vars
    /openlibrary/openlibrary/templates/type/edition/view.html in __template__
              $:macros.databarWork(edition or work, worldcat_links, affiliate_links, editions_page=True, render_times=component_times) ...
    ▶ Local vars
    /openlibrary/infogami/utils/template.py in saferender
                    result = t(*a, **kw) ...
    ▶ Local vars
    /openlibrary/infogami/utils/template.py in g
                    return f(*a, **kw) ...
    ▶ Local vars
    /openlibrary/infogami/utils/template.py in <lambda>
                    return lambda *a, **kw: saferender(templates, *a, **kw) ...
    ▶ Local vars
    /openlibrary/infogami/utils/template.py in template
                return t(page, *a, **kw) ...
    ▶ Local vars
    /openlibrary/infogami/utils/view.py in thingview
            return render.view(page) ...
    ▶ Local vars
    /openlibrary/openlibrary/templates/viewpage.html in __template__
        $ view = thingview(page) ...
    ▶ Local vars
    /openlibrary/infogami/utils/template.py in saferender
                    result = t(*a, **kw) ...
    ▶ Local vars
    /openlibrary/infogami/utils/template.py in g
                    return f(*a, **kw) ...
    ▶ Local vars
    /openlibrary/infogami/utils/template.py in <lambda>
                    return lambda *a, **kw: saferender(templates, *a, **kw) ...
    ▶ Local vars
    /openlibrary/infogami/core/code.py in GET
                    return render.viewpage(p) ...
    ▶ Local vars
    /openlibrary/infogami/utils/app.py in delegate
                return getattr(cls(), method)(*args) ...
    ▶ Local vars
    /openlibrary/infogami/utils/app.py in <lambda>
            HEAD = GET = POST = PUT = DELETE = lambda self: delegate() ...
    ▶ Local vars
    /home/openlibrary/.local/lib/python3.12/site-packages/web/application.py in handle_class
                    return tocall(*args) ...
    ▶ Local vars
    /home/openlibrary/.local/lib/python3.12/site-packages/web/application.py in _delegate
                    return handle_class(cls) ...
    ▶ Local vars
    /home/openlibrary/.local/lib/python3.12/site-packages/web/application.py in handle
                return self._delegate(fn, self.fvars, args) ...
    ▶ Local vars
    /home/openlibrary/.local/lib/python3.12/site-packages/web/application.py in process
                            return self.handle() ...
    ▶ Local vars 

Technical

Testing

Screenshot

Stakeholders

@RayBB RayBB requested a review from cdrini May 16, 2025 03:59
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working like a charm now 👍 (This is likely from what appears to be a bug in the way ImportBot uploads covers.... 😬 )

@cdrini cdrini merged commit 0180e2c into master May 16, 2025
8 checks passed
@cdrini cdrini deleted the fix-cover-aspect-ratio-author branch May 16, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants