diff --git a/flask_script/__init__.py b/flask_script/__init__.py index 5a926ea..8a74138 100644 --- a/flask_script/__init__.py +++ b/flask_script/__init__.py @@ -143,18 +143,20 @@ def __call__(self, app=None, **kwargs): If your sub-Manager does not override this, any values for options will get lost. """ - if app is None: - app = self.app + if self.app is None: if app is None: raise Exception("There is no app here. This is unlikely to work.") + self.app = app + elif app is not None: + kwargs['app'] = app - if isinstance(app, Flask): + if isinstance(self.app, Flask): if kwargs: import warnings warnings.warn("Options will be ignored.") - return app + return self.app - app = app(**kwargs) + app = self.app(**kwargs) self.app = app return app