Skip to content

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

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

Closed
Calinou opened this issue Feb 5, 2021 · 1 comment · Fixed by #233
Labels
Accepted Accepted issue on our roadmap Good First Issue Good for new contributors Improvement Minor improvement to code

Comments

@Calinou
Copy link

Calinou commented Feb 5, 2021

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?

@humitos
Copy link
Member

humitos commented Feb 8, 2021

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 humitos added Accepted Accepted issue on our roadmap Improvement Minor improvement to code Good First Issue Good for new contributors labels Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Good First Issue Good for new contributors Improvement Minor improvement to code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants