john-bodley commented on a change in pull request #9279: [dashboard][api] Fix,
PUT publish/draft to not clean slug and owners
URL:
https://github.com/apache/incubator-superset/pull/9279#discussion_r391273225
##########
File path: superset/views/dashboard/api.py
##########
@@ -88,12 +88,12 @@ class BaseDashboardSchema(BaseOwnedSchema):
@pre_load
def pre_load(self, data): # pylint: disable=no-self-use
super().pre_load(data)
- data["slug"] = data.get("slug")
- data["owners"] = data.get("owners", [])
- if data["slug"]:
+ if data.get("slug"):
data["slug"] = data["slug"].strip()
data["slug"] = data["slug"].replace(" ", "-")
data["slug"] = re.sub(r"[^\w\-]+", "", data["slug"])
+ if "owners" in data:
+ data["owners"] = data.get("owners", [])
Review comment:
Why are lines 95 - 96 required? If the `owners` key is in `data` then
`data.get("owners", [])` is equivalent to `data["owners"]` and thus line 96
becomes `data["owners"] = data["owners"]` which is unnecessary.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]