Skip to content

Commit

Permalink
address dpgaspar's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Jul 5, 2020
1 parent 5687673 commit 8967e8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion superset/utils/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from typing import Any, Callable, cast, Optional, Type

from flask import current_app, g, request
from sqlalchemy.exc import SQLAlchemyError

from superset.stats_logger import BaseStatsLogger

Expand Down Expand Up @@ -173,6 +174,6 @@ def log( # pylint: disable=too-many-locals
sesh = current_app.appbuilder.get_session
sesh.bulk_save_objects(logs)
sesh.commit()
except Exception as ex: # pylint: disable=broad-except
except SQLAlchemyError as ex:
logging.error("DBEventLogger failed to log event(s)")
logging.exception(ex)
6 changes: 3 additions & 3 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,13 +542,13 @@ def explore_json(
@expose("/import_dashboards", methods=["GET", "POST"])
def import_dashboards(self) -> FlaskResponse:
"""Overrides the dashboards using json instances from the file."""
f = request.files.get("file")
if request.method == "POST" and f:
import_file = request.files.get("file")
if request.method == "POST" and import_file:
success = False
database_id = request.form.get("db_id")
try:
dashboard_import_export.import_dashboards(
db.session, f.stream, database_id
db.session, import_file.stream, database_id
)
success = True
except DatabaseNotFound as ex:
Expand Down

0 comments on commit 8967e8c

Please sign in to comment.