mirror of https://github.com/apache/superset.git
fix urlib opener bug (#8788)
This commit is contained in:
parent
ed3944ebef
commit
b053d66ea7
|
@ -264,7 +264,8 @@ def _get_slice_data(schedule):
|
|||
raise URLError(response.getcode())
|
||||
|
||||
# TODO: Move to the csv module
|
||||
rows = [r.split(b",") for r in response.content.splitlines()]
|
||||
content = response.read()
|
||||
rows = [r.split(b",") for r in content.splitlines()]
|
||||
|
||||
if schedule.delivery_type == EmailDeliveryType.inline:
|
||||
data = None
|
||||
|
@ -281,7 +282,7 @@ def _get_slice_data(schedule):
|
|||
)
|
||||
|
||||
elif schedule.delivery_type == EmailDeliveryType.attachment:
|
||||
data = {__("%(name)s.csv", name=slc.slice_name): response.content}
|
||||
data = {__("%(name)s.csv", name=slc.slice_name): content}
|
||||
body = __(
|
||||
'<b><a href="%(url)s">Explore in Superset</a></b><p></p>',
|
||||
name=slc.slice_name,
|
||||
|
|
|
@ -378,7 +378,7 @@ class SchedulesTestCase(SupersetTestCase):
|
|||
mock_open.return_value = response
|
||||
mock_urlopen.return_value = response
|
||||
mock_urlopen.return_value.getcode.return_value = 200
|
||||
response.content = self.CSV
|
||||
response.read.return_value = self.CSV
|
||||
|
||||
schedule = (
|
||||
db.session.query(SliceEmailSchedule)
|
||||
|
@ -404,8 +404,7 @@ class SchedulesTestCase(SupersetTestCase):
|
|||
mock_open.return_value = response
|
||||
mock_urlopen.return_value = response
|
||||
mock_urlopen.return_value.getcode.return_value = 200
|
||||
response.content = self.CSV
|
||||
|
||||
response.read.return_value = self.CSV
|
||||
schedule = (
|
||||
db.session.query(SliceEmailSchedule)
|
||||
.filter_by(id=self.slice_schedule)
|
||||
|
|
Loading…
Reference in New Issue