Mercurial > p > roundup > code
diff roundup/mailgw.py @ 3367:a23863a95326
handle missing Subject lines better [SF#1198729]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 24 Jun 2005 06:47:44 +0000 |
| parents | 3124e578db02 |
| children | 4f3285913a8c |
line wrap: on
line diff
--- a/roundup/mailgw.py Fri Jun 24 06:38:14 2005 +0000 +++ b/roundup/mailgw.py Fri Jun 24 06:47:44 2005 +0000 @@ -72,7 +72,7 @@ an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.164 2005-04-13 03:38:22 richard Exp $ +$Id: mailgw.py,v 1.165 2005-06-24 06:43:03 richard Exp $ """ __docformat__ = 'restructuredtext' @@ -579,11 +579,21 @@ if message.getheader('x-roundup-loop', ''): raise IgnoreLoop + # handle the subject line + subject = message.getheader('subject', '') + if not subject: + raise MailUsageError, ''' +Emails to Roundup trackers must include a Subject: line! +''' + # detect Precedence: Bulk, or Microsoft Outlook autoreplies if (message.getheader('precedence', '') == 'bulk' - or message.getheader('subject', '').lower().find("autoreply") > 0): + or subject.lower().find("autoreply") > 0): raise IgnoreBulk + if subject.strip().lower() == 'help': + raise MailUsageHelp + # config is used many times in this method. # make local variable for easier access config = self.instance.config @@ -609,20 +619,8 @@ if not from_list: from_list = message.getaddrlist('from') - # handle the subject line - subject = message.getheader('subject', '') - - if not subject: - raise MailUsageError, ''' -Emails to Roundup trackers must include a Subject: line! -''' - - if subject.strip().lower() == 'help': - raise MailUsageHelp - + # check for well-formed subject line m = self.subject_re.match(subject) - - # check for well-formed subject line if m: # get the classname classname = m.group('classname')
