csv_import: use flag default value (#37900)

Attribute instance can be unpickled and miss attributes added after the
creation of the pickle.
This commit is contained in:
Benjamin Dauvergne 2019-11-25 10:00:04 +01:00
parent f713d64735
commit 84b8f31ae1
1 changed files with 1 additions and 1 deletions

View File

@ -165,7 +165,7 @@ class CsvHeader(object):
flags = []
for attribute in attr.fields(self.__class__):
if attribute.metadata.get('flag'):
if getattr(self, attribute.name):
if getattr(self, attribute.name, attribute.default):
flags.append(attribute.name)
else:
flags.append('no-' + attribute.name.replace('_', '-'))