Skip to content
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

Fix: stop isbns from being <Nothing> in view.html #8859

Conversation

scottbarnes
Copy link
Collaborator

@scottbarnes scottbarnes commented Mar 2, 2024

For some reason edition.to_isbn10() and edition.to_isbn13 seem to be returning the good for nothing <Nothing> type in view.html.

This commit opts for None over other falsy values when setting isbn_10 and isbn_13.

Fix

Testing

Try to load a work or edition:

For some reason `edition.to_isbn10()` and `edition.to_isbn13` seem to be
returning the good for nothing `<Nothing>` type.

This commit opts for `None` over other falsy values when setting
`isbn_10` and `isbn_13`.
@scottbarnes scottbarnes added the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Mar 2, 2024
@jimchamp jimchamp self-assigned this Mar 2, 2024
@jimchamp
Copy link
Collaborator

jimchamp commented Mar 2, 2024

LGTM --- thanks, @scottbarnes!

@jimchamp jimchamp merged commit 809f141 into internetarchive:master Mar 2, 2024
3 checks passed
@jimchamp
Copy link
Collaborator

jimchamp commented Mar 2, 2024

@scottbarnes, I just remembered that we have a NothingEncoder that may help out in cases similar to this.
The encoder is defined here, and there's a usage example here.

This probably wouldn't have worked in this case. If I recall correctly, the dict was encoded in a template using json_encode, not by a json.dump call.

@jimchamp jimchamp removed the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants