Mercurial > p > roundup > code
diff roundup/mailgw.py @ 544:d32977eb8bd4
simple help command for mailgw
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 16 Jan 2002 07:20:54 +0000 |
| parents | ad6dbc21a570 |
| children | d276d72ebdaf |
line wrap: on
line diff
--- a/roundup/mailgw.py Wed Jan 16 07:02:57 2002 +0000 +++ b/roundup/mailgw.py Wed Jan 16 07:20:54 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.52 2002-01-15 00:12:40 richard Exp $ +$Id: mailgw.py,v 1.53 2002-01-16 07:20:54 richard Exp $ ''' @@ -90,6 +90,9 @@ class MailUsageError(ValueError): pass +class MailUsageHelp(Exception): + pass + class UnAuthorized(Exception): """ Access denied """ @@ -145,6 +148,15 @@ if sendto: try: return self.handle_message(message) + except MailUsageHelp: + # bounce the message back to the sender with the usage message + fulldoc = '\n'.join(string.split(__doc__, '\n')[2:]) + sendto = [sendto[0][1]] + m = [''] + m.append('\n\nMail Gateway Help\n=================') + m.append(fulldoc) + m = self.bounce_message(message, sendto, m, + subject="Mail Gateway Help") except MailUsageError, value: # bounce the message back to the sender with the usage message fulldoc = '\n'.join(string.split(__doc__, '\n')[2:]) @@ -238,7 +250,7 @@ # attach the original message to the returned message part = writer.nextpart() part.addheader('Content-Disposition','attachment') - part.addheader('Content-Description','Message that caused the error') + part.addheader('Content-Description','Message you sent') part.addheader('Content-Transfer-Encoding', '7bit') body = part.startbody('message/rfc822') body.write(m.getvalue()) @@ -253,6 +265,10 @@ ''' # handle the subject line subject = message.getheader('subject', '') + + if subject.strip() == 'help': + raise MailUsageHelp + m = subject_re.match(subject) if not m: raise MailUsageError, ''' @@ -731,6 +747,9 @@ # # $Log: not supported by cvs2svn $ +# Revision 1.52 2002/01/15 00:12:40 richard +# #503340 ] creating issue with [asignedto=p.ohly] +# # Revision 1.51 2002/01/14 02:20:15 richard # . changed all config accesses so they access either the instance or the # config attriubute on the db. This means that all config is obtained from
