-
Notifications
You must be signed in to change notification settings - Fork 383
Description
in the gmail.py
def fetch_mailboxes(self):
response, mailbox_list = self.imap.list()
if response == 'OK':
for mailbox in mailbox_list:
# Decode bytes to string if needed (Python 3)
if isinstance(mailbox, bytes):
mailbox = mailbox.decode('utf-8')
mailbox_name = mailbox.split('"/"')[-1].replace('"', '').strip()
mailbox = Mailbox(self)
mailbox.external_name = mailbox_name
self.mailboxes[mailbox_name] = mailbox
in the mailbox.py
remove uids = filter()
replace with :
# Decode bytes to string if needed (Python 3)
uid_data = data[0]
if isinstance(uid_data, bytes):
uid_data = uid_data.decode('utf-8')
uids = filter(None, uid_data.split(' ')) # filter out empty strings
in the utf.py - make it python 2.7 and 3.xx compatible
import sys
Python 2/3 compatibility
if sys.version_info[0] >= 3:
text_type = str
binary_type = bytes
else:
text_type = unicode
binary_type = str