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

init_app override constructor parameters #389

Closed
bonzanni opened this Issue Jan 28, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@bonzanni
Contributor

bonzanni commented Jan 28, 2015

The following code:

manager = APIManager(flask_sqlalchemy_db=db)
manager.init_app(app)

set the session property of APIManager to None producing surprising AttributeError while querying the apis. I think it would be more intuitive to not override previously set attributes.

@jfinkels

This comment has been minimized.

Owner

jfinkels commented Feb 2, 2015

This is probably related to issue #313. The way I have written init_app is incorrect, it needs to be redone.

@jfinkels jfinkels added the bug label Feb 2, 2015

jfinkels added a commit that referenced this issue Feb 2, 2015

Makes init_app() no longer store a Flask app
Before, the APIManager.init_app() method would store the Flask
application provided to it as `self.app`. This violates the rules for
approved Flask extensions, as it makes it impossible to initialize
multiple Flask applications in parallel.

This also fixes an issue with providing a session or Flask-SQLAlchemy
database object in the constructor of APIManager, and later initializing
the Flask application.

This fixes issues #313 and #389.
@jfinkels

This comment has been minimized.

Owner

jfinkels commented Feb 2, 2015

Merged a fix for this in pull request #392.

@jfinkels jfinkels closed this Feb 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment