Skip to content
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
Closed

init_app override constructor parameters #389

bonzanni opened this issue Jan 28, 2015 · 2 comments
Labels

Comments

@bonzanni
Copy link
Contributor

@bonzanni 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
Copy link
Owner

@jfinkels 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.

Loading

@jfinkels jfinkels added the bug label Feb 2, 2015
jfinkels added a commit that referenced this issue Feb 2, 2015
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
Copy link
Owner

@jfinkels jfinkels commented Feb 2, 2015

Merged a fix for this in pull request #392.

Loading

@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
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants