:arg ImapamiMail mail:
The mail data
:returns:
- True if the condition matches, else False.
+ None if nothing to check, True if the condition matches, else False.
"""
- return True
+ return None
def get_criteria(self):
"""
self.cond = cond
def check(self, ami, mail):
- return not self.cond.check(ami, mail)
+ ret = self.cond.check(ami, mail)
+ if ret is None:
+ return None
+ return not ret
register(ImapamiCondNot)
class ImapamiCondUnseen(ImapamiCond):
self.cond_list = cond_list
def check(self, ami, mail):
+ ret = None
for c in self.cond_list:
- if c.check(ami, mail) == False:
+ val = c.check(ami, mail)
+ if val is False:
return False
- return True
+ if val is True:
+ ret = True
+ return ret
register(ImapamiCondAnd)
class ImapamiCondOr(ImapamiCond):
self.cond_list = cond_list
def check(self, ami, mail):
+ ret = None
for c in self.cond_list:
- if c.check(ami, mail) == True:
+ val = c.check(ami, mail)
+ if val is True:
return True
- return False
+ if val is False:
+ ret = False
+ return ret
register(ImapamiCondOr)
class ImapamiCondEq(ImapamiCond):
mail_data['internal_date'])
mail = imapami.mail.ImapamiMail(**mail_data)
- if self.condition.check(ami, mail) == True:
+ if self.condition.check(ami, mail) in [None, True]:
ami.logger.debug("item %s matches conditions", item)
success = self.match_action.process(ami, mail)
else: