Skip to content

Commit

Permalink
Merge pull request apache#9 from ASUS-AICS/fix_Null_become_None_string
Browse files Browse the repository at this point in the history
Fix Null char becomes 'None' issue
  • Loading branch information
ArcherTsai authored Mar 19, 2020
2 parents 9b9dc8f + 75e99bc commit bd92e0f
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2817,21 +2817,24 @@ def generate():
isHeader = False
else:
for item in row:
# Remove extra commas
item = str(item).replace(',', ' ')
# Remove new lines in Windows
if '\r\n' in item:
item = item.replace('\r\n', ' ')
# Remove new lines in Linux and new MacOS
if '\n' in item:
item = item.replace('\n', ' ')
# Remove new lines in old MacOS
if '\r' in item:
item = item.replace('\r', ' ')
# Escape double quotes
if '"' in item:
item = item.replace('"', '""')
s += item + ','
if item != None:
# Remove extra commas
item = str(item).replace(',', ' ')
# Remove new lines in Windows
if '\r\n' in item:
item = item.replace('\r\n', ' ')
# Remove new lines in Linux and new MacOS
if '\n' in item:
item = item.replace('\n', ' ')
# Remove new lines in old MacOS
if '\r' in item:
item = item.replace('\r', ' ')
# Escape double quotes
if '"' in item:
item = item.replace('"', '""')
s += item + ','
else:
s += ','
s = s[:-1] + '\n'
yield s

Expand Down

0 comments on commit bd92e0f

Please sign in to comment.