Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Review flask-mongokit #432

Closed
jarus opened this Issue · 5 comments

3 participants

@jarus

In my eyes flask-mongokit fulfil all requirements for a aproved extension.
Please review.

Thanks

PS: It is already listed under extensions.

@jarus

There was a update of Flask-MongoKit which use the new cool app_context and it should be a good example of usage for other extension developers so it would be great to be a approved extension.

Christoph

@methane

https://github.com/jarus/flask-mongokit/blob/master/flask_mongokit.py#L140

I think .init_app(app) should not set self.app = app.
For example:

from flask import Flask
from flask.ext.mongokit import MongoKit

main_app = Flask(__name__)
mongo = MongoKit(main_app)

admin_app = Flask(__name__)
mongo.init_app(admin_app)

In this case, mongo should use main_app when out of context.

See also: https://github.com/mitsuhiko/flask-sqlalchemy/blob/master/flask_sqlalchemy.py#L783

@jarus

Thanks for this hint. I'm not 100% sure if you have a context than the extension should use the app of the context and is there no context than it should use the defined app, right?

Jarus

@jarus jarus referenced this issue in jarus/flask-mongokit
Open

Improve app context handling #14

@methane

@jarus http://flask.pocoo.org/docs/extensiondev/#initializing-extensions doesn't mention about fallbacking to default app.
But if extension has some feature they don't require app_context, allowing to use them outside of context is helpful.

@untitaker
Collaborator

please refile against https://github.com/pocoo/metaflask

@untitaker untitaker closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.