readthedocs.org
2d0fd2ae - Contextualize 404 page (#9657)

Commit
2 years ago
Contextualize 404 page (#9657) * WIP: Adds context to 404 page * WIP: Adds a test 404 page * Contextualization gives us 3 interesting scenarios for the 404 page * 404 handler: Receive exception keyword * Improve contextualized messages, not ready for review, needs further testing, and search for isn't safe to assume * Remove search form, that was a bad idea, since it will only work on standard Sphinx projects. * Early work on an approach that uses a custom Http404 exception to save relevant 404 context * Refactor error templates to separate contextualized handling + some template DRY stuff. * Apply new exceptions in some of the cases * Update readthedocs/proxito/exceptions.py Co-authored-by: Manuel Kaufmann <humitos@gmail.com> * Refactor unresolver * Move external version checks inside unresolver * !fixup 8cbff084845a9a7ad0fd660f96be8bab245ec171 * Update link to Custom 404 docs, remove rediraffe from tips * Apply suggestions from code review Co-authored-by: Manuel Kaufmann <humitos@gmail.com> * Raise custom 404 if subproject isn't found * WIP: Conclude structure of exception classes and templates, needs more content work * Updates from review * Reuse 404 view between proxito and general app, remove debug logging * Removes log.debug in views.serve * More work on text copy, fix bugs, raise ProxitoProjectVersionHttp404 in an additional case * Contextualize when subprojects aren't found. The disadvantages of the current decorator structure is worth paying attention to here. * Clean up * Add project:slug search scope when pages aren't found * clean up * Missed some linting there * fix pylint errors * Proxito: use unresolved in 404 handler * Don't use request.path as the "not found" path for proxito 404 exceptions * Updates from review * Missing imports * Linting: Too many blank lines * Add exception type for new 404 translation pages * Remove duplicated imports * Black * Fix exc * Update tests * Move check to new implementation only * Remove double error message for project 404s * Add missing kwarg proxito_path for subproject 404 exception * Updates from review * Add a new 404 exception class and targeted template for missing project translations * Updates from review * WIP: Simplify contextualized 404 messages into a set of exceptions. TODO: Remove from old Proxito implementation. * Revert changes on old proxito decorators implementation * WIP: refactor * Remove custom HTTP responses from most old proxito code, include CNAME DNS in contextualized 404 pattern, clean up context pattern a bit * Remove more changes to old proxito code * Remove more old proxito implementation changes * Use PRODUCTION_DOMAIN for search form action * Remove custom 404 handler from general app, have only that logic in proxito (for now?) * Remove a couple of additional unused patterns * Comment accuracy update * Update another comment * Revert DEBUG=False * Move exceptions from core to proxito + use "path" from 404 serve view in ContextualizedHttp404 * Rename a few things * Removed unused kwarg * Update test cases to check for expected 404 exception and HTTP status * Adds a test case variant to check the exception handling stack * Apply suggestions from @stsewd code review Co-authored-by: Santos Gallegos <stsewd@proton.me> * use pgettext with context for 404 subjects * change kwarg name, use some explicit kwargs * Fix imports to be absolute * Remove h3 from search bar when included with a search term * explicitly require certain exception arguments, trim the ones we're not (yet) using * Apply suggestions from @stsewd code review Co-authored-by: Santos Gallegos <stsewd@proton.me> * Remove |default filter and assume a value exists * Update readthedocs/templates/errors/404/include_tips.html Co-authored-by: Santos Gallegos <stsewd@proton.me> * Add more context for translators of not_found_subject --------- Co-authored-by: Manuel Kaufmann <humitos@gmail.com> Co-authored-by: Santos Gallegos <stsewd@proton.me>
Author
Parents
Loading