Avoid potential bugs when generating CSV results data for download

This commit is contained in:
Lance Edgar 2017-10-16 17:38:42 -07:00
parent 46b49ab987
commit f8e98a5817

View file

@ -1527,7 +1527,7 @@ class MasterView(View):
""" """
csvrow = {} csvrow = {}
for field in fields: for field in fields:
value = getattr(obj, field) value = getattr(obj, field, None)
csvrow[field] = '' if value is None else six.text_type(value) csvrow[field] = '' if value is None else six.text_type(value)
return csvrow return csvrow
@ -1537,7 +1537,7 @@ class MasterView(View):
""" """
csvrow = {} csvrow = {}
for field in fields: for field in fields:
value = getattr(row, field) value = getattr(row, field, None)
csvrow[field] = '' if value is None else six.text_type(value) csvrow[field] = '' if value is None else six.text_type(value)
return csvrow return csvrow