Python imaplib.Time2Internaldate() Examples

The following are 14 code examples of imaplib.Time2Internaldate(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module imaplib , or try the search function .
Example #1
Source File: imap.py    From mailur with GNU General Public License v3.0 6 votes vote down vote up
def _multiappend(con, box, msgs):
    with _cmd(con, 'APPEND') as (tag, start, complete):
        send = start
        for date_time, flags, msg in msgs:
            flags = clean_recent(flags)
            if date_time is None:
                date_time = Time2Internaldate(time.time())
            args = (' (%s) %s %s' % (flags, date_time, '{%s}' % len(msg)))
            if send == start:
                args = ' %s %s' % (box, args)
            send(args.encode() + CRLF)
            send = con.send
            while con._get_response():
                bad = con.tagged_commands[tag]
                if bad:
                    raise Error(bad)
            con.send(msg)
        con.send(CRLF)
        res = check(complete())
        log.debug('%s', res[0].decode())
        uids = con.untagged_responses.pop('APPENDUID')
        uids = uids[0].decode().split(' ', 1)[-1]
        return uids 
Example #2
Source File: test_imaplib.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_that_Time2Internaldate_returns_a_result(self):
        # We can check only that it successfully produces a result,
        # not the correctness of the result itself, since the result
        # depends on the timezone the machine is in.
        timevalues = [2000000000, 2000000000.0, time.localtime(2000000000),
                      '"18-May-2033 05:33:20 +0200"']

        for t in timevalues:
            imaplib.Time2Internaldate(t) 
Example #3
Source File: test_imaplib.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_that_Time2Internaldate_returns_a_result(self):
        # We can check only that it successfully produces a result,
        # not the correctness of the result itself, since the result
        # depends on the timezone the machine is in.
        timevalues = [2000000000, 2000000000.0, time.localtime(2000000000),
                      '"18-May-2033 05:33:20 +0200"']

        for t in timevalues:
            imaplib.Time2Internaldate(t) 
Example #4
Source File: test_imaplib.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_that_Time2Internaldate_returns_a_result(self):
        # We can check only that it successfully produces a result,
        # not the correctness of the result itself, since the result
        # depends on the timezone the machine is in.
        timevalues = [2000000000, 2000000000.0, time.localtime(2000000000),
                      '"18-May-2033 05:33:20 +0200"']

        for t in timevalues:
            imaplib.Time2Internaldate(t) 
Example #5
Source File: test_imaplib.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_Time2Internaldate(self):
        expected = '"18-May-2033 05:33:20 +0200"'

        for t in self.timevalues():
            internal = imaplib.Time2Internaldate(t)
            self.assertEqual(internal, expected) 
Example #6
Source File: test_imaplib.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_that_Time2Internaldate_returns_a_result(self):
        # Without tzset, we can check only that it successfully
        # produces a result, not the correctness of the result itself,
        # since the result depends on the timezone the machine is in.
        for t in self.timevalues():
            imaplib.Time2Internaldate(t) 
Example #7
Source File: test_imaplib.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_Time2Internaldate(self):
        expected = '"18-May-2033 05:33:20 +0200"'

        for t in self.timevalues():
            internal = imaplib.Time2Internaldate(t)
            self.assertEqual(internal, expected) 
Example #8
Source File: test_imaplib.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_that_Time2Internaldate_returns_a_result(self):
        # Without tzset, we can check only that it successfully
        # produces a result, not the correctness of the result itself,
        # since the result depends on the timezone the machine is in.
        for t in self.timevalues():
            imaplib.Time2Internaldate(t) 
Example #9
Source File: test_imaplib.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_that_Time2Internaldate_returns_a_result(self):
        # We can check only that it successfully produces a result,
        # not the correctness of the result itself, since the result
        # depends on the timezone the machine is in.
        timevalues = [2000000000, 2000000000.0, time.localtime(2000000000),
                      '"18-May-2033 05:33:20 +0200"']

        for t in timevalues:
            imaplib.Time2Internaldate(t) 
Example #10
Source File: test_imaplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_Time2Internaldate(self):
        expected = '"18-May-2033 05:33:20 +0200"'

        for t in self.timevalues():
            internal = imaplib.Time2Internaldate(t)
            self.assertEqual(internal, expected) 
Example #11
Source File: test_imaplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_that_Time2Internaldate_returns_a_result(self):
        # Without tzset, we can check only that it successfully
        # produces a result, not the correctness of the result itself,
        # since the result depends on the timezone the machine is in.
        for t in self.timevalues():
            imaplib.Time2Internaldate(t) 
Example #12
Source File: test_imaplib.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_that_Time2Internaldate_returns_a_result(self):
        # We can check only that it successfully produces a result,
        # not the correctness of the result itself, since the result
        # depends on the timezone the machine is in.
        timevalues = [2000000000, 2000000000.0, time.localtime(2000000000),
                      '"18-May-2033 05:33:20 +0200"']

        for t in timevalues:
            imaplib.Time2Internaldate(t) 
Example #13
Source File: imaputils.py    From modoboa-webmail with MIT License 5 votes vote down vote up
def push_mail(self, folder, msg):
        now = imaplib.Time2Internaldate(time.time())
        msg = bytes(msg) if six.PY3 else str(msg)
        return self.m.append(
            self._encode_mbox_name(folder), r'(\Seen)', now, msg) 
Example #14
Source File: test_imaplib.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_that_Time2Internaldate_returns_a_result(self):
        # We can check only that it successfully produces a result,
        # not the correctness of the result itself, since the result
        # depends on the timezone the machine is in.
        timevalues = [2000000000, 2000000000.0, time.localtime(2000000000),
                      '"18-May-2033 05:33:20 +0200"']

        for t in timevalues:
            imaplib.Time2Internaldate(t)