Skip to content

Commit

Permalink
Merge pull request #10048 from cdrini/10047/fix/mybooks-ia-only-book
Browse files Browse the repository at this point in the history
Fix My Books erroring when IA-only book borrowed
  • Loading branch information
cdrini authored Nov 19, 2024
2 parents 72d4547 + 6d3ac85 commit 8789cfc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions openlibrary/plugins/upstream/mybooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ def render_template(self, mb):
loans = web.Storage({"docs": [], "total_results": len(loans)})
# TODO: should do in one web.ctx.get_many fetch
for loan in myloans:
book = web.ctx.site.get(loan['book'])
book.loan = loan
loans.docs.append(book)
# Book will be None if no OL edition exists for the book
if book := web.ctx.site.get(loan['book']):
book.loan = loan
loans.docs.append(book)

if mb.me or mb.is_public:
params = {'sort': 'created', 'limit': 6, 'sort_order': 'desc', 'page': 1}
Expand Down

0 comments on commit 8789cfc

Please sign in to comment.