diff options
| author | Barry Warsaw | 2007-07-14 21:23:28 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2007-07-14 21:23:28 -0400 |
| commit | 327865eaf118f40063366acad9c7d97487e010d6 (patch) | |
| tree | eda494bb7560b1427813ae7ec51a22e3d0444703 /Mailman/Commands | |
| parent | 288ae405b09baa443eb1b39422c48c315fbb2e5a (diff) | |
| download | mailman-327865eaf118f40063366acad9c7d97487e010d6.tar.gz mailman-327865eaf118f40063366acad9c7d97487e010d6.tar.zst mailman-327865eaf118f40063366acad9c7d97487e010d6.zip | |
Other than contrib files, convert all imports of mm_cfg to imports of config.
Ignore mailman.egg-info
In bin/make_instance.py: Catch and ignore import errors when importing
Mailman.i18n. Before this script has actually been run, there won't be enough
infrastructure in place of the import to succeed. Include several other fixes
in this file.
Add install_requires to the setup script.
Diffstat (limited to 'Mailman/Commands')
| -rw-r--r-- | Mailman/Commands/cmd_confirm.py | 4 | ||||
| -rw-r--r-- | Mailman/Commands/cmd_help.py | 6 | ||||
| -rw-r--r-- | Mailman/Commands/cmd_lists.py | 1 | ||||
| -rw-r--r-- | Mailman/Commands/cmd_password.py | 6 | ||||
| -rw-r--r-- | Mailman/Commands/cmd_set.py | 43 | ||||
| -rw-r--r-- | Mailman/Commands/cmd_who.py | 22 |
6 files changed, 41 insertions, 41 deletions
diff --git a/Mailman/Commands/cmd_confirm.py b/Mailman/Commands/cmd_confirm.py index 99d1fab39..49aa85267 100644 --- a/Mailman/Commands/cmd_confirm.py +++ b/Mailman/Commands/cmd_confirm.py @@ -21,9 +21,9 @@ supplied by a mailback confirmation notice. """ -from Mailman import mm_cfg from Mailman import Errors from Mailman import Pending +from Mailman.configuration import config from Mailman.i18n import _ STOP = 1 @@ -46,7 +46,7 @@ def process(res, args): results = mlist.ProcessConfirmation(cookie, res.msg) except Errors.MMBadConfirmation, e: # Express in approximate days - days = int(mm_cfg.PENDING_REQUEST_LIFE / mm_cfg.days(1) + 0.5) + days = int(config.PENDING_REQUEST_LIFE / config.days(1) + 0.5) res.results.append(_("""\ Invalid confirmation string. Note that confirmation strings expire approximately %(days)s days after the initial subscription request. If your diff --git a/Mailman/Commands/cmd_help.py b/Mailman/Commands/cmd_help.py index 33e908295..1afe25697 100644 --- a/Mailman/Commands/cmd_help.py +++ b/Mailman/Commands/cmd_help.py @@ -19,11 +19,11 @@ Print this help message. """ -import sys import os +import sys -from Mailman import mm_cfg from Mailman import Utils +from Mailman.configuration import config from Mailman.i18n import _ EMPTYSTRING = '' @@ -81,7 +81,7 @@ def process(res, args): helptext = Utils.maketext( 'help.txt', {'listname' : mlist.real_name, - 'version' : mm_cfg.VERSION, + 'version' : config.VERSION, 'listinfo_url': mlist.GetScriptURL('listinfo', absolute=1), 'requestaddr' : mlist.GetRequestEmail(), 'adminaddr' : mlist.GetOwnerEmail(), diff --git a/Mailman/Commands/cmd_lists.py b/Mailman/Commands/cmd_lists.py index 6d23d4745..f7c6365e3 100644 --- a/Mailman/Commands/cmd_lists.py +++ b/Mailman/Commands/cmd_lists.py @@ -20,7 +20,6 @@ See a list of the public mailing lists on this GNU Mailman server. """ -from Mailman import mm_cfg from Mailman.MailList import MailList from Mailman.configuration import config from Mailman.i18n import _ diff --git a/Mailman/Commands/cmd_password.py b/Mailman/Commands/cmd_password.py index 278dad3c0..ff9ae8762 100644 --- a/Mailman/Commands/cmd_password.py +++ b/Mailman/Commands/cmd_password.py @@ -28,7 +28,7 @@ from email.Utils import parseaddr -from Mailman import mm_cfg +from Mailman.configuration import config from Mailman.i18n import _ STOP = 1 @@ -77,7 +77,7 @@ def process(res, args): newpasswd = args[1] realname, address = parseaddr(res.msg['from']) if mlist.isMember(address): - if mlist.Authenticate((mm_cfg.AuthUser, mm_cfg.AuthListAdmin), + if mlist.Authenticate((config.AuthUser, config.AuthListAdmin), oldpasswd, address): mlist.setMemberPassword(address, newpasswd) res.results.append(_('Password successfully changed.')) @@ -103,7 +103,7 @@ current password, then try again.""")) address = args[2][8:] res.returnaddr = address if mlist.isMember(address): - if mlist.Authenticate((mm_cfg.AuthUser, mm_cfg.AuthListAdmin), + if mlist.Authenticate((config.AuthUser, config.AuthListAdmin), oldpasswd, address): mlist.setMemberPassword(address, newpasswd) res.results.append(_('Password successfully changed.')) diff --git a/Mailman/Commands/cmd_set.py b/Mailman/Commands/cmd_set.py index 549628a76..dc53be243 100644 --- a/Mailman/Commands/cmd_set.py +++ b/Mailman/Commands/cmd_set.py @@ -12,14 +12,15 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. from email.Utils import parseaddr, formatdate -from Mailman import mm_cfg from Mailman import Errors from Mailman import MemberAdaptor from Mailman import i18n +from Mailman.configuration import config def _(s): return s @@ -149,13 +150,13 @@ class SetCommands: _('You are not a member of the %(listname)s mailing list')) return STOP res.results.append(_('Your current option settings:')) - opt = mlist.getMemberOption(address, mm_cfg.AcknowledgePosts) + opt = mlist.getMemberOption(address, config.AcknowledgePosts) onoff = opt and _('on') or _('off') res.results.append(_(' ack %(onoff)s')) # Digests are a special ternary value - digestsp = mlist.getMemberOption(address, mm_cfg.Digests) + digestsp = mlist.getMemberOption(address, config.Digests) if digestsp: - plainp = mlist.getMemberOption(address, mm_cfg.DisableMime) + plainp = mlist.getMemberOption(address, config.DisableMime) if plainp: res.results.append(_(' digest plain')) else: @@ -186,18 +187,18 @@ class SetCommands: res.results.append(_(' %(status)s (%(how)s on %(date)s)')) else: res.results.append(' ' + status) - opt = mlist.getMemberOption(address, mm_cfg.DontReceiveOwnPosts) + opt = mlist.getMemberOption(address, config.DontReceiveOwnPosts) # sense is reversed onoff = (not opt) and _('on') or _('off') res.results.append(_(' myposts %(onoff)s')) - opt = mlist.getMemberOption(address, mm_cfg.ConcealSubscription) + opt = mlist.getMemberOption(address, config.ConcealSubscription) onoff = opt and _('on') or _('off') res.results.append(_(' hide %(onoff)s')) - opt = mlist.getMemberOption(address, mm_cfg.DontReceiveDuplicates) + opt = mlist.getMemberOption(address, config.DontReceiveDuplicates) # sense is reversed onoff = (not opt) and _('on') or _('off') res.results.append(_(' duplicates %(onoff)s')) - opt = mlist.getMemberOption(address, mm_cfg.SuppressPasswordReminder) + opt = mlist.getMemberOption(address, config.SuppressPasswordReminder) # sense is reversed onoff = (not opt) and _('on') or _('off') res.results.append(_(' reminders %(onoff)s')) @@ -218,8 +219,8 @@ class SetCommands: res.results.append( _('You are not a member of the %(listname)s mailing list')) return STOP - if not mlist.Authenticate((mm_cfg.AuthUser, - mm_cfg.AuthListAdmin), + if not mlist.Authenticate((config.AuthUser, + config.AuthListAdmin), password, address): res.results.append(_('You did not give the correct password')) return STOP @@ -250,7 +251,7 @@ class SetCommands: status = self._status(res, args[0]) if status < 0: return STOP - mlist.setMemberOption(self.__address, mm_cfg.AcknowledgePosts, status) + mlist.setMemberOption(self.__address, config.AcknowledgePosts, status) res.results.append(_('ack option set')) def set_digest(self, res, args): @@ -264,21 +265,21 @@ class SetCommands: arg = args[0].lower() if arg == 'off': try: - mlist.setMemberOption(self.__address, mm_cfg.Digests, 0) + mlist.setMemberOption(self.__address, config.Digests, 0) except Errors.AlreadyReceivingRegularDeliveries: pass elif arg == 'plain': try: - mlist.setMemberOption(self.__address, mm_cfg.Digests, 1) + mlist.setMemberOption(self.__address, config.Digests, 1) except Errors.AlreadyReceivingDigests: pass - mlist.setMemberOption(self.__address, mm_cfg.DisableMime, 1) + mlist.setMemberOption(self.__address, config.DisableMime, 1) elif arg == 'mime': try: - mlist.setMemberOption(self.__address, mm_cfg.Digests, 1) + mlist.setMemberOption(self.__address, config.Digests, 1) except Errors.AlreadyReceivingDigests: pass - mlist.setMemberOption(self.__address, mm_cfg.DisableMime, 0) + mlist.setMemberOption(self.__address, config.DisableMime, 0) else: res.results.append(_('Bad argument: %(arg)s')) self._usage(res) @@ -311,7 +312,7 @@ class SetCommands: if status < 0: return STOP # sense is reversed - mlist.setMemberOption(self.__address, mm_cfg.DontReceiveOwnPosts, + mlist.setMemberOption(self.__address, config.DontReceiveOwnPosts, not status) res.results.append(_('myposts option set')) @@ -322,7 +323,7 @@ class SetCommands: status = self._status(res, args[0]) if status < 0: return STOP - mlist.setMemberOption(self.__address, mm_cfg.ConcealSubscription, + mlist.setMemberOption(self.__address, config.ConcealSubscription, status) res.results.append(_('hide option set')) @@ -334,7 +335,7 @@ class SetCommands: if status < 0: return STOP # sense is reversed - mlist.setMemberOption(self.__address, mm_cfg.DontReceiveDuplicates, + mlist.setMemberOption(self.__address, config.DontReceiveDuplicates, not status) res.results.append(_('duplicates option set')) @@ -346,7 +347,7 @@ class SetCommands: if status < 0: return STOP # sense is reversed - mlist.setMemberOption(self.__address, mm_cfg.SuppressPasswordReminder, + mlist.setMemberOption(self.__address, config.SuppressPasswordReminder, not status) res.results.append(_('reminder option set')) diff --git a/Mailman/Commands/cmd_who.py b/Mailman/Commands/cmd_who.py index 8470ef9d6..ecd1786d8 100644 --- a/Mailman/Commands/cmd_who.py +++ b/Mailman/Commands/cmd_who.py @@ -17,8 +17,8 @@ from email.Utils import parseaddr -from Mailman import mm_cfg from Mailman import i18n +from Mailman.configuration import config STOP = 1 @@ -79,8 +79,8 @@ def process(res, args): # Public rosters if args: if len(args) == 1: - if mlist.Authenticate((mm_cfg.AuthListModerator, - mm_cfg.AuthListAdmin), + if mlist.Authenticate((config.AuthListModerator, + config.AuthListAdmin), args[0]): full = True else: @@ -102,15 +102,15 @@ def process(res, args): usage(res) return STOP if mlist.isMember(address) and mlist.Authenticate( - (mm_cfg.AuthUser, - mm_cfg.AuthListModerator, - mm_cfg.AuthListAdmin), + (config.AuthUser, + config.AuthListModerator, + config.AuthListAdmin), password, address): # Then ok = True if mlist.Authenticate( - (mm_cfg.AuthListModerator, - mm_cfg.AuthListAdmin), + (config.AuthListModerator, + config.AuthListAdmin), password): # Then ok = full = True @@ -119,8 +119,8 @@ def process(res, args): if len(args) <> 1: usage(res) return STOP - if mlist.Authenticate((mm_cfg.AuthListModerator, - mm_cfg.AuthListAdmin), + if mlist.Authenticate((config.AuthListModerator, + config.AuthListAdmin), args[0]): ok = full = True if not ok: @@ -137,7 +137,7 @@ def process(res, args): def addmembers(members): for member in members: if not full and mlist.getMemberOption(member, - mm_cfg.ConcealSubscription): + config.ConcealSubscription): continue realname = mlist.getMemberName(member) if realname: |
