mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
chore: upgrade black (#19410)
This commit is contained in:
@@ -104,14 +104,19 @@ class DashboardPermalinkRestApi(BaseApi):
|
||||
try:
|
||||
state = self.add_model_schema.load(request.json)
|
||||
key = CreateDashboardPermalinkCommand(
|
||||
actor=g.user, dashboard_id=pk, state=state,
|
||||
actor=g.user,
|
||||
dashboard_id=pk,
|
||||
state=state,
|
||||
).run()
|
||||
http_origin = request.headers.environ.get("HTTP_ORIGIN")
|
||||
url = f"{http_origin}/superset/dashboard/p/{key}/"
|
||||
return self.response(201, key=key, url=url)
|
||||
except (ValidationError, DashboardPermalinkInvalidStateError) as ex:
|
||||
return self.response(400, message=str(ex))
|
||||
except (DashboardAccessDeniedError, KeyValueAccessDeniedError,) as ex:
|
||||
except (
|
||||
DashboardAccessDeniedError,
|
||||
KeyValueAccessDeniedError,
|
||||
) as ex:
|
||||
return self.response(403, message=str(ex))
|
||||
except DashboardNotFoundError as ex:
|
||||
return self.response(404, message=str(ex))
|
||||
|
||||
@@ -31,7 +31,10 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class CreateDashboardPermalinkCommand(BaseDashboardPermalinkCommand):
|
||||
def __init__(
|
||||
self, actor: User, dashboard_id: str, state: DashboardPermalinkState,
|
||||
self,
|
||||
actor: User,
|
||||
dashboard_id: str,
|
||||
state: DashboardPermalinkState,
|
||||
):
|
||||
self.actor = actor
|
||||
self.dashboard_id = dashboard_id
|
||||
@@ -46,7 +49,9 @@ class CreateDashboardPermalinkCommand(BaseDashboardPermalinkCommand):
|
||||
"state": self.state,
|
||||
}
|
||||
key = CreateKeyValueCommand(
|
||||
actor=self.actor, resource=self.resource, value=value,
|
||||
actor=self.actor,
|
||||
resource=self.resource,
|
||||
value=value,
|
||||
).run()
|
||||
return encode_permalink_key(key=key.id, salt=self.salt)
|
||||
except SQLAlchemyError as ex:
|
||||
|
||||
@@ -19,7 +19,9 @@ from marshmallow import fields, Schema
|
||||
|
||||
class DashboardPermalinkPostSchema(Schema):
|
||||
filterState = fields.Dict(
|
||||
required=False, allow_none=True, description="Native filter state",
|
||||
required=False,
|
||||
allow_none=True,
|
||||
description="Native filter state",
|
||||
)
|
||||
urlParams = fields.List(
|
||||
fields.Tuple(
|
||||
|
||||
Reference in New Issue
Block a user