Beispiel #1
0
 def _migrate_email_log(self, event, item):
     info = item._logInfo
     entry = self._migrate_log(event, item)
     entry.realm = EventLogRealm.emails
     entry.type = 'email'
     entry.summary = 'Sent email: {}'.format(convert_to_unicode(info['subject']).strip())
     content_type = convert_to_unicode(info.get('contentType')) or (
         'text/html' if seems_html(info['body']) else 'text/plain')
     entry.data = {
         'from': convert_to_unicode(info['fromAddr']),
         'to': map(convert_to_unicode, set(info['toList'])),
         'cc': map(convert_to_unicode, set(info['ccList'])),
         'bcc': map(convert_to_unicode, set(info.get('bccList', []))),
         'subject': convert_to_unicode(info['subject']),
         'body': convert_to_unicode(info['body']),
         'content_type': content_type,
     }
     return entry
Beispiel #2
0
 def _migrate_email_log(self, event, item):
     info = item._logInfo
     entry = self._migrate_log(event, item)
     entry.realm = EventLogRealm.emails
     entry.type = "email"
     entry.summary = "Sent email: {}".format(convert_to_unicode(info["subject"]).strip())
     content_type = convert_to_unicode(info.get("contentType")) or (
         "text/html" if seems_html(info["body"]) else "text/plain"
     )
     entry.data = {
         "from": convert_to_unicode(info["fromAddr"]),
         "to": map(convert_to_unicode, set(info["toList"])),
         "cc": map(convert_to_unicode, set(info["ccList"])),
         "bcc": map(convert_to_unicode, set(info.get("bccList", []))),
         "subject": convert_to_unicode(info["subject"]),
         "body": convert_to_unicode(info["body"]),
         "content_type": content_type,
     }
     return entry
Beispiel #3
0
 def _migrate_email_log(self, event, item):
     info = item._logInfo
     entry = self._migrate_log(event, item)
     entry.realm = EventLogRealm.emails
     entry.type = 'email'
     entry.summary = 'Sent email: {}'.format(
         convert_to_unicode(info['subject']).strip())
     content_type = convert_to_unicode(info.get('contentType')) or (
         'text/html' if seems_html(info['body']) else 'text/plain')
     entry.data = {
         'from': convert_to_unicode(info['fromAddr']),
         'to': map(convert_to_unicode, set(info['toList'])),
         'cc': map(convert_to_unicode, set(info['ccList'])),
         'bcc': map(convert_to_unicode, set(info.get('bccList', []))),
         'subject': convert_to_unicode(info['subject']),
         'body': convert_to_unicode(info['body']),
         'content_type': content_type,
     }
     return entry
Beispiel #4
0
def test_seems_html():
    assert seems_html('<b>test')
    assert seems_html('a <b> c')
    assert not seems_html('test')
    assert not seems_html('a < b > c')
Beispiel #5
0
def test_seems_html():
    assert seems_html('<b>test')
    assert seems_html('a <b> c')
    assert not seems_html('test')
    assert not seems_html('a < b > c')
Beispiel #6
0
 def getLogContentType(self):
     return self._logInfo.get(
         "contentType",
         "text/html" if seems_html(self._logInfo['body']) else 'text/plain')
Beispiel #7
0
 def getLogContentType(self):
     return self._logInfo.get("contentType", "text/html" if seems_html(self._logInfo['body']) else 'text/plain')
Beispiel #8
0
def test_seems_html():
    assert seems_html("<b>test")
    assert seems_html("a <b> c")
    assert not seems_html("test")
    assert not seems_html("a < b > c")