Skip to content

fix: dropper AttributeError when redirect stub has no title#13188

Open
TechGenius-Karan wants to merge 1 commit into
internetarchive:masterfrom
TechGenius-Karan:13169/fix/dropper-title-attribute-error
Open

fix: dropper AttributeError when redirect stub has no title#13188
TechGenius-Karan wants to merge 1 commit into
internetarchive:masterfrom
TechGenius-Karan:13169/fix/dropper-title-attribute-error

Conversation

@TechGenius-Karan

Copy link
Copy Markdown
Contributor

Closes #13169

fix

Technical

add_storage_items_for_redirects in bookshelves.py inserts a bare web.storage({"key": key}) stub for any reading log work that is missing from Solr and has no edition key. That stub then flows into dropper.html where line 29 does work.title — but web.storage.__getattr__ raises AttributeError for any missing key, producing the reported template error.

Two-part fix:

  1. bookshelves.py (line 282) — include "title": "" in the stub, consistent with how add_storage_items_for_deletes always includes a title in its stubs.
  2. dropper.html (line 29) — switch from work.title to work.get('title', '') for defense in depth; this is already how edition is handled on the same line.

Testing

Reproduce: have a reading log entry whose work has been redirected to another OL key and was added without a specific edition. Open /people/<username>/books/want-to-read.

  • Before: AttributeError: 'title' in template, falls back to default template
  • After: page renders normally; the redirected entry shows with no title (empty string)

Screenshot

Backend-only fix, no UI change.

Stakeholders

@cdrini @mekarpeles

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.

Want-to-read list throws error in processing template

2 participants