Cannot support list of dates in Email Message Header
gtback opened this issue · comments
Minimal example to reproduce:
import datetime as dt
from cybox.objects.email_message_object import EmailHeader
hdr = EmailHeader()
hdr.date = [dt.datetime.now(), dt.datetime.now()]
hdr.to_xml()
Returns:
~/code/mixbox/mixbox/dates.py in serialize_datetime(value)
39 if not value:
40 return None
---> 41 return value.isoformat()
42
43
AttributeError: 'list' object has no attribute 'isoformat'
I'm not sure the best place to fix this. It may be using cybox.properties.ListDateTimeField
rather than cybox.properties.DateTime
with a normal TypedField. But this change would probably need to be more pervasive than just this one field. It needs more investigation.