Check for key in props (#8)

This commit is contained in:
Alfredo
2019-05-22 12:20:10 +02:00
committed by Joshua Tauberer
parent a8e1e8f064
commit eee84c759f
+13
View File
@@ -64,24 +64,37 @@ def load_message_stream(entry, is_top_level, doc):
else:
# Construct common headers from metadata.
if 'MESSAGE_DELIVERY_TIME' in props:
msg['Date'] = formatdate(props['MESSAGE_DELIVERY_TIME'].timestamp())
del props['MESSAGE_DELIVERY_TIME']
if 'SENDER_NAME' in props:
if 'SENT_REPRESENTING_NAME' in props:
if props['SENT_REPRESENTING_NAME']:
if props['SENDER_NAME'] != props['SENT_REPRESENTING_NAME']:
props['SENDER_NAME'] += " (" + props['SENT_REPRESENTING_NAME'] + ")"
del props['SENT_REPRESENTING_NAME']
if props['SENDER_NAME']:
msg['From'] = formataddr((props['SENDER_NAME'], ""))
del props['SENDER_NAME']
if 'DISPLAY_TO' in props:
if props['DISPLAY_TO']:
msg['To'] = props['DISPLAY_TO']
del props['DISPLAY_TO']
if 'DISPLAY_CC' in props:
if props['DISPLAY_CC']:
msg['CC'] = props['DISPLAY_CC']
del props['DISPLAY_CC']
if 'DISPLAY_BCC' in props:
if props['DISPLAY_BCC']:
msg['BCC'] = props['DISPLAY_BCC']
del props['DISPLAY_BCC']
if 'SUBJECT' in props:
if props['SUBJECT']:
msg['Subject'] = props['SUBJECT']
del props['SUBJECT']