This pull request includes a new exception type to raise when attachment parsing does not work and a hook to ignore attachment parsing entirely as a work-around. There's a little bit of PEP8 cleanup as well. Not sure anyone else will actually need this but I figured I'd make it available as a result of running into an exception like the following:
File "/path/venv/lib/python2.7/site-packages/gmail/mailbox.py", line 74, in mail
self.messages.update(self.gmail.fetch_multiple_messages(messages_dict))
File "/path/venv/lib/python2.7/site-packages/gmail/gmail.py", line 156, in fetch_multiple_messages
messages[uid].parse(raw_message)
File "/path/venv/lib/python2.7/site-packages/gmail/message.py", line 173, in parse
if not isinstance(attachment, basestring) and attachment.get('Content-Disposition') is not None
File "/path/venv/lib/python2.7/site-packages/gmail/message.py", line 223, in __init__
self.size = int(round(len(self.payload)/1000.0))
TypeError: object of type 'NoneType' has no len()
This pull request includes a new exception type to raise when attachment parsing does not work and a hook to ignore attachment parsing entirely as a work-around. There's a little bit of PEP8 cleanup as well. Not sure anyone else will actually need this but I figured I'd make it available as a result of running into an exception like the following: