Skip to content

Commit

Permalink
Merge branch 'briancappello-application_factory_kwargs'
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Dec 9, 2016
2 parents 67baa5d + 57c82f3 commit 4ab45f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions flask_migrate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ def __init__(self, app=None, db=None, directory='migrations', **kwargs):
self.configure_callbacks = []
self.db = db
self.directory = directory
self.alembic_ctx_kwargs = kwargs
if app is not None and db is not None:
self.init_app(app, db, directory, **kwargs)
self.init_app(app, db, directory)

def init_app(self, app, db=None, directory=None, **kwargs):
self.db = db or self.db
self.directory = directory or self.directory
self.alembic_ctx_kwargs.update(kwargs)
if not hasattr(app, 'extensions'):
app.extensions = {}
app.extensions['migrate'] = _MigrateConfig(self, self.db, **kwargs)
app.extensions['migrate'] = _MigrateConfig(self, self.db,
**self.alembic_ctx_kwargs)

def configure(self, f):
self.configure_callbacks.append(f)
Expand Down

0 comments on commit 4ab45f6

Please sign in to comment.