-
Notifications
You must be signed in to change notification settings - Fork 93
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 already registered #44
Comments
Ugh I didn't realize this could happen, that's frustrating. How would you even "destroy the whole application object"? |
Obviously with No just kidding, but there is a But destroying the app-context wouldn't be the solution to this anyways … so I don't know if we are overlooking something more fundamental? Maybe we can ask for help? So funny when old GitHub issues pop up and your issue-context got destroyed and you have to recreate it again ;P glad you replied :) |
This is all a bit above my head tbh. I just want to name my blueprints what I want 😂 I didn't realize anything is "persistent" when you stop and re-run the application. |
No, this is not persistent from run to run. I guess it just says that if a blueprint is registered, you will have to destroy the app object and there is no unregister function. And yes, you are free to name your blueprints however you like, but the name has to be unique. Isn't this namespaced anyways?
I am a bit out of the loop regarding this issue and will have to dig more into flask (which I am currently not even using) and maybe ask for help. So I am just re-iterating my first comment on this: the issue is that `add_blueprint_list()` is called twice (by flask-security and by flask-empty) and this attempts to register the (already registered) blueprints again, but obviously, blueprint names have to be unique.
I guess we are overlooking something relatively simple here and it seems improbable that nobody ran into this issue before or that is indeed a bug in flask.
|
Can you show a minimal example? add_blueprint_list is not called by flask-security. |
I seem to be having this problem too. I was getting this error on some nested blueprints (which in my code are only explicitly registered once). I came across this and removed flask_login, and that stopped the error. I'm still not sure what is going on exactly. |
I get this warning that will become an error:
I checked out the source and in
main.py
app_factory()
callsapp.add_blueprint_list()
. However, flask-security also tries to register all blueprints. Since flask'sadd_blueprint()
method doesn't check wether a blueprint is already registered or not, it is attempted to register the same blueprints twice.You can not unregister a blueprint:
Who should fix this?
add_blueprint
is a part of flask … should every caller implement their own logic to check if a blueprint was already registered?The text was updated successfully, but these errors were encountered: