Update of /cvsroot/mailman/mailman/Mailman/Commands
In directory sc8-pr-cvs1:/tmp/cvs-serv6478

Modified Files:
      Tag: Release_2_1-maint
        cmd_set.py 
Log Message:
set_delivery(): Fixed the email command 'set delivery [on|off]' which
was trying to use the setMemberOption() interface.  This doesn't work
for delivery settings -- it needed to use the setDeliveryStatus()
interface.


Index: cmd_set.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Commands/cmd_set.py,v
retrieving revision 2.1
retrieving revision 2.1.2.1
diff -u -d -r2.1 -r2.1.2.1
--- cmd_set.py  17 Aug 2002 00:29:23 -0000      2.1
+++ cmd_set.py  19 Nov 2003 23:01:24 -0000      2.1.2.1
@@ -1,4 +1,4 @@
-# Copyright (C) 2002 by the Free Software Foundation, Inc.
+# Copyright (C) 2002-2003 by the Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -292,10 +292,16 @@
         status = self._status(res, args[0])
         if status < 0:
             return STOP
-        # sense is reversed
-        mlist.setMemberOption(self.__address, mm_cfg.DisableDelivery,
-                              not status)
-        res.results.append(_('delivery option set'))
+        # Delivery status is handled differently than other options.  If
+        # status is true (set delivery on), then we enable delivery.
+        # Otherwise, we have to use the setDeliveryStatus() interface to
+        # specify that delivery was disabled by the user.
+        if status:
+            mlist.setDeliveryStatus(self.__address, MemberAdaptor.ENABLED)
+            res.results.append(_('delivery enabled'))
+        else:
+            mlist.setDeliveryStatus(self.__address, MemberAdaptor.BYUSER)
+            res.results.append(_('delivery disabled by user'))
 
     def set_myposts(self, res, args):
         mlist = res.mlist
@@ -308,7 +314,7 @@
         mlist.setMemberOption(self.__address, mm_cfg.DontReceiveOwnPosts,
                               not status)
         res.results.append(_('myposts option set'))
-        
+
     def set_hide(self, res, args):
         mlist = res.mlist
         if len(args) <> 1:
@@ -343,7 +349,7 @@
         mlist.setMemberOption(self.__address, mm_cfg.SuppressPasswordReminder,
                               not status)
         res.results.append(_('reminder option set'))
-        
+
 
 
 def process(res, args):



_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins

Reply via email to