Commit 5873bcaa authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

sender may be missing, return None instead of empty list

parent 6dbedfc5b3e2
"""entity classes for entity types provided by the cubicweb email package
:organization: Logilab
:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:copyright: 2003-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
......@@ -35,16 +35,15 @@ class Email(TreeMixIn, AnyEntity):
@property
def senderaddr(self):
return self.sender[0]
return self.sender and self.sender[0] or None
@property
def in_reply_to(self):
return self.reply_to and self.reply_to[0]
return self.reply_to and self.reply_to[0] or None
@property
def thread(self):
return self.in_thread and self.in_thread[0]
return self.in_thread and self.in_thread[0] or None
def parts_in_order(self, prefered_mime_type='text/html'):
"""sort an email parts in order, selecting among alternatives according to a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment