Пример #1
0
 def test2(self):
     x=email_decode('=?UTF-8?B?dGVzdC3Em8WhxI3FmcW+w73DocOtw6nDusWvxaXEjy50eHQ=?=')
     self.assertTrue(isinstance(x, six.text_type))
     self.assertEqual(x, u'test-ěščřžýáíéúůťď.txt')
     
     x=email_decode('divny =?UTF-8?B?xI1lc2vDvQ==?=')
     self.assertTrue(isinstance(x, six.text_type))
     self.assertEqual(x, u'divny český')
Пример #2
0
    def test2(self):
        x = email_decode(
            '=?UTF-8?B?dGVzdC3Em8WhxI3FmcW+w73DocOtw6nDusWvxaXEjy50eHQ=?=')
        self.assertTrue(isinstance(x, six.text_type))
        self.assertEqual(x, u'test-ěščřžýáíéúůťď.txt')

        x = email_decode('divny =?UTF-8?B?xI1lc2vDvQ==?=')
        self.assertTrue(isinstance(x, six.text_type))
        self.assertEqual(x, u'divny český')
Пример #3
0
 def update_part_info(self, part_info):
     self['mime']= format_mime(part_info.type, part_info.sub_type )
     sz=part_info.size
     if part_info.encoding == 'base64':
         sz= (sz // 4) * 3  # aproximate would be enough - for exact size we'll need to check padding
     self['size'] = sz
     name = email_decode(part_info.params.get('name', '') if part_info.params else '')
     filename = email_decode(part_info.disposition.get('filename', '') if part_info.disposition else '')
     self['name'] = name or filename
     att=part_info.disposition and part_info.disposition.get('disposition')
     self['attached'] = (att== 'attachment')
     self['section'] = part_info.section
Пример #4
0
 def __init__(self, folder, search_response, part_info=None):
     super(MailInfo,self).__init__()
     self['folder']=folder
     date= search_response[b'INTERNALDATE']
     self['date'] = date
     self['year'] = date.year
     self['month'] = date.month
     self['day'] = date.day
     flags=search_response[b'FLAGS']
     self['answered']= b'\\Answered' in flags
     self['seen'] = b'\\Seen' in flags
     self['flagged'] = b'\\Flagged' in flags
     self['deleted'] = b'\\Deleted' in flags
     self['recent'] = b'\\Recent' in flags
     self['draft'] = b'\\Draft' in flags
     self['flags'] = TagList(flags)
     envelope=search_response[b'ENVELOPE']
     #log.debug('ENVELOPE %s', envelope)
     self['subject'] = email_decode(envelope.subject)
     self['from'] = format_addresses(envelope.from_)
     self['sender'] = format_addresses(envelope.sender)
     self['to'] = format_addresses(envelope.to)
     self['cc'] = format_addresses(envelope.cc)
     self['bcc'] = format_addresses(envelope.bcc)
     
     if part_info:
         self.update_part_info(part_info)
Пример #5
0
 def test1(self):
     x = email_decode(
         six.b('=?ISO-8859-2?Q?Odpov=ECdi_na_dotazy=5FM=A9MT=5F2006.doc?='))
     self.assertTrue(isinstance(x, six.text_type))
     self.assertEqual(x, u'Odpovědi na dotazy_MŠMT_2006.doc')
Пример #6
0
 def test1(self):
     x=email_decode(six.b('=?ISO-8859-2?Q?Odpov=ECdi_na_dotazy=5FM=A9MT=5F2006.doc?='))
     self.assertTrue(isinstance(x, six.text_type))
     self.assertEqual(x, u'Odpovědi na dotazy_MŠMT_2006.doc')