diff roundup/mailgw.py @ 2671:1154e7fa2f47 maint-0.7

mailgw can override the MAIL_DEFUALT_CLASS
author Richard Jones <richard@users.sourceforge.net>
date Tue, 14 Sep 2004 22:03:43 +0000
parents 42f69daa70b2
children 7f24a0222d36
line wrap: on
line diff
--- a/roundup/mailgw.py	Tue Sep 07 10:37:52 2004 +0000
+++ b/roundup/mailgw.py	Tue Sep 14 22:03:43 2004 +0000
@@ -74,7 +74,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.149.2.1 2004-09-07 10:37:52 richard Exp $
+$Id: mailgw.py,v 1.149.2.2 2004-09-14 22:03:42 richard Exp $
 """
 __docformat__ = 'restructuredtext'
 
@@ -311,10 +311,15 @@
         (\[(?P<args>.+?)\])?                          # [prop=value]
         ''', re.IGNORECASE|re.VERBOSE)
 
-    def __init__(self, instance, db, arguments={}):
+    def __init__(self, instance, db, arguments=()):
         self.instance = instance
         self.db = db
         self.arguments = arguments
+        self.default_class = None
+        for option, value in self.arguments:
+            if option == '-c':
+                self.default_class = value.strip()
+
         self.mailer = Mailer(instance.config)
 
         # should we trap exceptions (normal usage) or pass them through
@@ -633,6 +638,8 @@
                     sendto = [from_list[0][1]]
                     self.mailer.standard_message(sendto, subject, '') 
                     return
+                elif self.default_class:
+                    classname = self.default_class
                 elif hasattr(self.instance.config, 'MAIL_DEFAULT_CLASS') and \
                          self.instance.config.MAIL_DEFAULT_CLASS:
                     classname = self.instance.config.MAIL_DEFAULT_CLASS

Roundup Issue Tracker: http://roundup-tracker.org/