示例#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
示例#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
示例#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
示例#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')
示例#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')
示例#6
0
文件: log.py 项目: marcosmolla/indico
 def getLogContentType(self):
     return self._logInfo.get(
         "contentType",
         "text/html" if seems_html(self._logInfo['body']) else 'text/plain')
示例#7
0
 def getLogContentType(self):
     return self._logInfo.get("contentType", "text/html" if seems_html(self._logInfo['body']) else 'text/plain')
示例#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")