-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
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
Blueprint view function name should not contain dots #2790
Comments
Looks fine to me, although personally I'd go with The linked issue explains what's wrong with dots in endpoint names: you can't tell which part is the blueprint vs the endpoint. Dots are for separating blueprints and endpoints. When we implement nestable blueprints (#593, #1548) it would be even more important that dots only separate full names (and would also probably make what you're doing now easier). For now, the easiest solution is to refactor the names to use another separator. Sorry for the trouble caused! |
Well if you don't have nestable blueprints, then the part before the first
Thanks for the response anyway. |
during generting the routes for the node. References: pallets/flask@2f57a0b pallets/flask#2790 Fixes #3360 Reported by: Marcelo Mendes Investigated by: Khushboo Vashi
I've done some homework and read up on #2450. I don't really understand the rationale behind that PR, and I don't think it really helps with Flask usage overall. To explain a bit...
I maintain a relatively complex project that builds its own API on top of Flask. This change heavily breaks our application structure, as we currently use dots as separators for view classes under our blueprints. Consider the following:
main
main.about
main.about.privacy
for exampleNow, one solution would be to use some other separator. Why not
about/privacy
?about-privacy
? The thing is, regardless of what separator you decide to use there, blueprints must always be separated from the view name using a.
. So in,url_for()
for example, we would have to useurl_for("main.about/privacy")
, which just looks plain ugly.Some sample code
A sample route:How we register this route:
This seems like the correct way to be doing this, right?
So, to summarize, here's what I'm asking:
The text was updated successfully, but these errors were encountered: