Browse files

Updated message printing

The plain and html properties use get() to make sure they don't just up
and crash if the variant does not exist.  Also updated the printing
mechanism that will prefer plain and fallback to html, or print a 'no
message' message.
  • Loading branch information...
rca committed Sep 23, 2013
1 parent 62a2669 commit 225d63f48e6808edcaa42d486e6d350a3e141750
Showing with 3 additions and 3 deletions.
  1. +1 −1 imapbot/
  2. +2 −2 imapbot/
@@ -65,7 +65,7 @@ def handle_message(self, message):
with open('message.txt', 'ab') as fh:
- print message.plain
+ print message.plain or message.html or 'no message'
def idle(self):
if self._is_idle:
@@ -55,8 +55,8 @@ def parsed(self):
def html(self):
- return self.parsed['text/html']
+ return self.parsed.get('text/html')
def plain(self):
- return self.parsed['text/plain']
+ return self.parsed.get('text/plain')

0 comments on commit 225d63f

Please sign in to comment.