Skip to content
Closed
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions superset/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,21 @@ def index(self):

sm = appbuilder.sm

before_request_functions = conf.get('BEFORE_REQUEST_FUNCTIONS')


@app.before_request
def before_request():
for f in before_request_functions:
try:
f()
except Exception as e:
print(
'Exception {} in before_request function {}'
.format(e, f.func_name))
logging.exception(e)


results_backend = app.config.get('RESULTS_BACKEND')

# Registering sources
Expand Down
2 changes: 2 additions & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ class CeleryConfig(object):

CONFIG_PATH_ENV_VAR = 'SUPERSET_CONFIG_PATH'

# List of functions that are executed before every request. Order may matter.
BEFORE_REQUEST_FUNCTIONS = []

# smtp server configuration
EMAIL_NOTIFICATIONS = False # all the emails are sent using dryrun
Expand Down