sphinx-notfound-page icon indicating copy to clipboard operation
sphinx-notfound-page copied to clipboard

Disabling prefix leads to "WARNING: The config value `notfound_urls_prefix' has type `NoneType', defaults to `str'."

Open Calinou opened this issue 4 years ago • 1 comments

Python version: 3.9.0 Sphinx version: 1.8.5 sphinx-notfound-page version: 0.6

Here's the relevant part of my conf.py:

# sphinx-notfound-page
# https://github.com/readthedocs/sphinx-notfound-page
notfound_context = {
    "title": "Page Not Found",
    "body": """
<h1>Page Not Found</h1>
<p>Sorry, we couldn"t find that page.</p>
<p>Try using the search box or go to the homepage.</p>
""",
}

# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
on_rtd = os.environ.get("READTHEDOCS", None) == "True"

# Don't add `/en/latest` prefix during local development.
# This makes it easier to test the custom 404 page by loading `/404.html`
# on a local web server.
if not on_rtd:
    notfound_urls_prefix = None

I've been able to avoid this by setting the value to '' (empty string) instead, but the documentation doesn't mention this. I guess we should just update the documentation to reflect this?

Calinou avatar Feb 05 '21 20:02 Calinou

Thanks for reporting this. I think we need to modify our code where we defined the setting, https://github.com/rtfd/sphinx-notfound-page/blob/f30850e4a648e4490824499671f72522e41c66fa/notfound/extension.py#L270-L276, to accept None as well using types=[str, None] probably following https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_config_value

humitos avatar Feb 08 '21 10:02 humitos