Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

allow sub-manager tasks to use own app rather than parent's #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions flask_script/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down