votes up 3

'endpoint' may not contain a dot '.' character.

Package:
flask
github stars 56479
Exception Class:
ValueError

Raise code

        view_func: t.Optional[t.Callable] = None,
        **options: t.Any,
    ) -> None:
        """Like :meth:`Flask.add_url_rule` but for a blueprint.  The endpoint for
        the :func:`url_for` function is prefixed with the name of the blueprint.
        """
        if endpoint and "." in endpoint:
            raise ValueError("'endpoint' may not contain a dot '.' character.")

        if view_func and hasattr(view_func, "__name__") and "." in view_func.__name__:
            raise ValueError("'view_func' name may not contain a dot '.' character.")

        self.record(lambda s: s.add_url_rule(rule, endpoint, view_func, **options))

    def app_template_filter(self, name: t.Optional[str] = None) -> t.Callable:
😲 Agile task management is now easier than calling a taxi. #Tracklify
🙏 Scream for help to Ukraine
Today, 2nd July 2022, Russia continues bombing and firing Ukraine. Don't trust Russia, they are bombing us and brazenly lying in same time they are not doing this 😠, civilians and children are dying too! We are screaming and asking exactly you to help us, we want to survive, our families, children, older ones.
Please spread the information, and ask your governemnt to stop Russia by any means. We promise to work extrahard after survival to make the world safer place for all.

Ways to fix

votes up 1 votes down

Summary

Endpoints in flasks add_url_rule method must not contain dot '.' characters.

Reproduce

from flask import Flask
app = Flask(__name__)

def i():
    return ""

app.add_url_rule("/", view_func=i, endpoint="index.html")

app.run()

Fix

from flask import Flask
app = Flask(__name__)

def i():
    return ""

app.add_url_rule("/", view_func=i, endpoint="index") #<-- endpoint must not have a dot '.' character

app.run()
May 29, 2021 cRyp70s answer
cRyp70s 113

Add a possible fix

Please authorize to post fix