def request_folders(self): lst = [] # Always create a new connection as an existing one may # be used for IMAP IDLE. conn = self._connect() try: status, data = conn.list('', '*') finally: self._disconnect(conn) for d in data: match = re.match('.+\s+("."|"?NIL"?)\s+"?([^"]+)"?$', d) if match == None: logging.warning("Folder format not supported.") else: folder = match.group(2) lst.append(decode_mutf7(folder)) return lst
def test_decode_mutf7(): expected = 'Die Katzen & die Mäuse' result = decode_mutf7('Die Katzen &- die M&AOQ-use') assert expected == result
def test_decode_mutf7(): expected = u'Die Katzen & die Mäuse' result = decode_mutf7('Die Katzen &- die M&AOQ-use') assert expected == result