Mercurial > p > roundup > code
diff roundup/mailgw.py @ 616:08abec25b2c6
[SF#503204] mailgw needs a default class
- partially done - the setting of additional properties can wait for a
better configuration system.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 15 Feb 2002 00:13:38 +0000 |
| parents | 7c2c4840db6a |
| children | cdcee6721841 |
line wrap: on
line diff
--- a/roundup/mailgw.py Thu Feb 14 23:46:02 2002 +0000 +++ b/roundup/mailgw.py Fri Feb 15 00:13:38 2002 +0000 @@ -73,7 +73,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.64 2002-02-14 23:46:02 richard Exp $ +$Id: mailgw.py,v 1.65 2002-02-15 00:13:38 richard Exp $ ''' @@ -120,7 +120,7 @@ return Message(s) subject_re = re.compile(r'(?P<refwd>\s*\W?\s*(fwd|re|aw)\s*\W?\s*)*' - r'\s*(\[(?P<classname>[^\d\s]+)(?P<nodeid>\d+)?\])' + r'\s*(\[(?P<classname>[^\d\s]+)(?P<nodeid>\d+)?\])?' r'\s*(?P<title>[^[]+)?(\[(?P<args>.+?)\])?', re.I) class MailGW: @@ -292,6 +292,20 @@ raise MailUsageHelp m = subject_re.match(subject) + + # check for well-formed subject line + if m: + # get the classname + classname = m.group('classname') + if classname is None: + # no classname, fallback on the default + if hasattr(self.instance, 'MAIL_DEFAULT_CLASS') and \ + self.instance.MAIL_DEFAULT_CLASS: + classname = self.instance.MAIL_DEFAULT_CLASS + else: + # fail + m = None + if not m: raise MailUsageError, ''' The message you sent to roundup did not contain a properly formed subject @@ -307,8 +321,7 @@ Subject was: "%s" '''%subject - # get the classname - classname = m.group('classname') + # get the class try: cl = self.db.getclass(classname) except KeyError: @@ -790,6 +803,9 @@ # # $Log: not supported by cvs2svn $ +# Revision 1.64 2002/02/14 23:46:02 richard +# . #516883 ] mail interface + ANONYMOUS_REGISTER +# # Revision 1.63 2002/02/12 08:08:55 grubert # . Clean up mail handling, multipart handling. #
