`/developers/routes` displays internal error message
Problem
The content of the /developers/routes page cannot be rendered due to an internal error. The json.dumps() call, here, is failing with a TypeError - '<' not supported between instances of 'str' and 'NoneType'.
This page is referenced throughout our wiki.
See: https://openlibrary.org/developers/routes
https://github.com/internetarchive/openlibrary/blob/1547af51e046dce80ddaf060f0783e01ee080798/openlibrary/plugins/openlibrary/code.py#L209-L227
This is happening because some keys are None
dct: {None: <class 'openlibrary.plugins.openlibrary.lists.lists'>, 'json': <class 'openlibrary.plugins.openlibrary.lists.lists_json'>, 'yml': <class 'openlibrary.plugins.openlibrary.lists.lists_yaml'>}
Solution
removing sort_keys=True, should fix
https://github.com/internetarchive/openlibrary/blob/1547af51e046dce80ddaf060f0783e01ee080798/openlibrary/plugins/openlibrary/code.py#L223C13-L223C28
Reproducing the bug
- Go to /developers/routes
- Expected behavior: The page loads without error
- Actual behavior: The page displays an error
Context
- Browser (Chrome, Safari, Firefox, etc): Any
- OS (Windows, Mac, etc): Any
- Logged in (Y/N): N
- Environment (prod, dev, local): dev / prod
Breakdown
Requirements Checklist
- [ ]
Related files
Stakeholders
Instructions for Contributors
- Please run these commands to ensure your repository is up to date before creating a new branch to work on this issue and each time after pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.
Hello! I'd like to work on this issue. Would that be okay?
Hi, I would like to work on this issue!
First come, first served. @seohyeonlee2020, you are assigned. Please reach out if you have any questions, and be sure to manually test your work before opening a PR.
Thank you!
Hi @jimchamp, I noticed this issue is currently assigned, but I would also love to work on it. If @seohyeonlee2020 is not actively working, could I take it up or help out?
@Gurleen-kansray I am working on this issue.
@seohyeonlee2020 Thanks for letting me know! Good luck with the fix. Let me know if you need any help along the way.
@jimchamp I just created a PR: https://github.com/internetarchive/openlibrary/pull/11292