diff options
| -rw-r--r-- | Mailman/Bouncer.py | 2 | ||||
| -rw-r--r-- | Mailman/Defaults.py | 2 | ||||
| -rw-r--r-- | Mailman/Handlers/CalcRecips.py | 2 | ||||
| -rw-r--r-- | Mailman/Handlers/CookHeaders.py | 2 | ||||
| -rw-r--r-- | Mailman/Handlers/ToDigest.py | 2 | ||||
| -rw-r--r-- | Mailman/app/lifecycle.py | 2 | ||||
| -rw-r--r-- | Mailman/app/membership.py | 2 | ||||
| -rw-r--r-- | Mailman/app/moderator.py | 3 | ||||
| -rw-r--r-- | Mailman/app/styles.py | 3 | ||||
| -rw-r--r-- | Mailman/bin/add_members.py | 2 | ||||
| -rw-r--r-- | Mailman/bin/list_members.py | 2 | ||||
| -rw-r--r-- | Mailman/bin/set_members.py | 2 | ||||
| -rw-r--r-- | Mailman/constants.py | 62 | ||||
| -rw-r--r-- | Mailman/database/model/roster.py | 3 | ||||
| -rw-r--r-- | Mailman/docs/acknowledge.txt | 2 | ||||
| -rw-r--r-- | Mailman/docs/addresses.txt | 5 | ||||
| -rw-r--r-- | Mailman/docs/avoid-duplicates.txt | 8 | ||||
| -rw-r--r-- | Mailman/docs/calc-recips.txt | 2 | ||||
| -rw-r--r-- | Mailman/docs/file-recips.txt | 5 | ||||
| -rw-r--r-- | Mailman/docs/membership.txt | 2 | ||||
| -rw-r--r-- | Mailman/docs/reply-to.txt | 2 | ||||
| -rw-r--r-- | Mailman/docs/requests.txt | 6 | ||||
| -rw-r--r-- | Mailman/interfaces/action.py | 31 | ||||
| -rw-r--r-- | Mailman/interfaces/mailinglist.py | 16 | ||||
| -rw-r--r-- | Mailman/interfaces/member.py | 41 |
25 files changed, 121 insertions, 90 deletions
diff --git a/Mailman/Bouncer.py b/Mailman/Bouncer.py index e823a3859..5aa72f3ce 100644 --- a/Mailman/Bouncer.py +++ b/Mailman/Bouncer.py @@ -29,7 +29,7 @@ from Mailman import Message from Mailman import Utils from Mailman import i18n from Mailman.configuration import config -from Mailman.constants import DeliveryStatus +from Mailman.interfaces import DeliveryStatus EMPTYSTRING = '' diff --git a/Mailman/Defaults.py b/Mailman/Defaults.py index 90dddfa53..203fd878b 100644 --- a/Mailman/Defaults.py +++ b/Mailman/Defaults.py @@ -20,7 +20,7 @@ import os from datetime import timedelta -from Mailman.constants import * +from Mailman.interfaces import ReplyToMunging diff --git a/Mailman/Handlers/CalcRecips.py b/Mailman/Handlers/CalcRecips.py index 29135999c..ebaf941c9 100644 --- a/Mailman/Handlers/CalcRecips.py +++ b/Mailman/Handlers/CalcRecips.py @@ -27,8 +27,8 @@ from Mailman import Errors from Mailman import Message from Mailman import Utils from Mailman.configuration import config -from Mailman.constants import DeliveryStatus from Mailman.i18n import _ +from Mailman.interfaces import DeliveryStatus diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py index 82c87c20b..24bf0e829 100644 --- a/Mailman/Handlers/CookHeaders.py +++ b/Mailman/Handlers/CookHeaders.py @@ -28,8 +28,8 @@ from Mailman import Utils from Mailman import Version from Mailman.app.archiving import get_base_archive_url from Mailman.configuration import config -from Mailman.constants import ReplyToMunging from Mailman.i18n import _ +from Mailman.interfaces import ReplyToMunging CONTINUATION = ',\n\t' COMMASPACE = ', ' diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py index 8bd13f2e6..6f06df43b 100644 --- a/Mailman/Handlers/ToDigest.py +++ b/Mailman/Handlers/ToDigest.py @@ -52,7 +52,7 @@ from Mailman.Handlers.Scrubber import process as scrubber from Mailman.Mailbox import Mailbox from Mailman.Mailbox import Mailbox from Mailman.configuration import config -from Mailman.constants import DeliveryMode, DeliveryStatus +from Mailman.interfaces import DeliveryMode, DeliveryStatus from Mailman.queue import Switchboard _ = i18n._ diff --git a/Mailman/app/lifecycle.py b/Mailman/app/lifecycle.py index 8c693d39d..8abb14c69 100644 --- a/Mailman/app/lifecycle.py +++ b/Mailman/app/lifecycle.py @@ -27,7 +27,7 @@ from Mailman.Utils import ValidateEmail from Mailman.app.plugins import get_plugin from Mailman.app.styles import style_manager from Mailman.configuration import config -from Mailman.constants import MemberRole +from Mailman.interfaces import MemberRole __all__ = [ 'create_list', diff --git a/Mailman/app/membership.py b/Mailman/app/membership.py index 3096ae7f4..e950f790a 100644 --- a/Mailman/app/membership.py +++ b/Mailman/app/membership.py @@ -25,7 +25,7 @@ from Mailman import Message from Mailman import Utils from Mailman import i18n from Mailman.configuration import config -from Mailman.constants import DeliveryMode, MemberRole +from Mailman.interfaces import DeliveryMode, MemberRole _ = i18n._ __i18n_templates__ = True diff --git a/Mailman/app/moderator.py b/Mailman/app/moderator.py index 720a5a364..0557f4332 100644 --- a/Mailman/app/moderator.py +++ b/Mailman/app/moderator.py @@ -39,8 +39,7 @@ from Mailman import Utils from Mailman import i18n from Mailman.app.membership import add_member, delete_member from Mailman.configuration import config -from Mailman.constants import Action, DeliveryMode -from Mailman.interfaces import RequestType +from Mailman.interfaces import Action, DeliveryMode, RequestType from Mailman.queue import Switchboard _ = i18n._ diff --git a/Mailman/app/styles.py b/Mailman/app/styles.py index 606b388ed..06a82cccf 100644 --- a/Mailman/app/styles.py +++ b/Mailman/app/styles.py @@ -27,8 +27,7 @@ from Mailman import Utils from Mailman.Errors import DuplicateStyleError from Mailman.app.plugins import get_plugins from Mailman.configuration import config -from Mailman.constants import Action -from Mailman.interfaces import IStyle, IStyleManager +from Mailman.interfaces import Action, IStyle, IStyleManager __metaclass__ = type diff --git a/Mailman/bin/add_members.py b/Mailman/bin/add_members.py index 5d1400a9a..7a3a381c8 100644 --- a/Mailman/bin/add_members.py +++ b/Mailman/bin/add_members.py @@ -32,8 +32,8 @@ from Mailman import Version from Mailman import i18n from Mailman.app.membership import add_member from Mailman.configuration import config -from Mailman.constants import DeliveryMode from Mailman.initialize import initialize +from Mailman.interfaces import DeliveryMode _ = i18n._ __i18n_templates__ = True diff --git a/Mailman/bin/list_members.py b/Mailman/bin/list_members.py index d9721761b..2784bcd6d 100644 --- a/Mailman/bin/list_members.py +++ b/Mailman/bin/list_members.py @@ -24,9 +24,9 @@ from Mailman import Errors from Mailman import Utils from Mailman import Version from Mailman.configuration import config -from Mailman.constants import DeliveryStatus from Mailman.i18n import _ from Mailman.initialize import initialize +from Mailman.interfaces import DeliveryStatus __i18n_templates__ = True diff --git a/Mailman/bin/set_members.py b/Mailman/bin/set_members.py index 83df7381b..dc3211966 100644 --- a/Mailman/bin/set_members.py +++ b/Mailman/bin/set_members.py @@ -27,8 +27,8 @@ from Mailman import i18n from Mailman import passwords from Mailman.app.membership import add_member from Mailman.configuration import config -from Mailman.constants import DeliveryMode from Mailman.initialize import initialize +from Mailman.interfaces import DeliveryMode _ = i18n._ diff --git a/Mailman/constants.py b/Mailman/constants.py index cb2a656dc..47455b3c4 100644 --- a/Mailman/constants.py +++ b/Mailman/constants.py @@ -17,52 +17,13 @@ """Various constants and enumerations.""" -from munepy import Enum -from zope.interface import implements - -from Mailman.interfaces import IPreferences - __all__ = [ - 'Action', - 'DeliveryMode', - 'DeliveryStatus', - 'MemberRole', - 'ReplyToMunging', 'SystemDefaultPreferences', ] - -class DeliveryMode(Enum): - # Regular (i.e. non-digest) delivery - regular = 1 - # Plain text digest delivery - plaintext_digests = 2 - # MIME digest delivery - mime_digests = 3 - # Summary digests - summary_digests = 4 - - - -class DeliveryStatus(Enum): - # Delivery is enabled - enabled = 1 - # Delivery was disabled by the user - by_user = 2 - # Delivery was disabled due to bouncing addresses - by_bounces = 3 - # Delivery was disabled by an administrator or moderator - by_moderator = 4 - # Disabled for unknown reasons. - unknown = 5 - - - -class MemberRole(Enum): - member = 1 - owner = 2 - moderator = 3 +from Mailman.interfaces import DeliveryMode, DeliveryStatus, IPreferences +from zope.interface import implements @@ -76,22 +37,3 @@ class SystemDefaultPreferences(object): receive_own_postings = True delivery_mode = DeliveryMode.regular delivery_status = DeliveryStatus.enabled - - - -class ReplyToMunging(Enum): - # The Reply-To header is passed through untouched - no_munging = 0 - # The mailing list's posting address is appended to the Reply-To header - point_to_list = 1 - # An explicit Reply-To header is added - explicit_header = 2 - - - -class Action(Enum): - hold = 0 - reject = 1 - discard = 2 - accept = 3 - defer = 4 diff --git a/Mailman/database/model/roster.py b/Mailman/database/model/roster.py index 8440e0ffc..e59bc8b17 100644 --- a/Mailman/database/model/roster.py +++ b/Mailman/database/model/roster.py @@ -25,10 +25,9 @@ moderator, and administrator roster filters. from sqlalchemy import * from zope.interface import implements -from Mailman.constants import DeliveryMode, MemberRole from Mailman.constants import SystemDefaultPreferences from Mailman.database.model import Address, Member -from Mailman.interfaces import IRoster +from Mailman.interfaces import DeliveryMode, IRoster, MemberRole diff --git a/Mailman/docs/acknowledge.txt b/Mailman/docs/acknowledge.txt index 88d9d6251..c1280095a 100644 --- a/Mailman/docs/acknowledge.txt +++ b/Mailman/docs/acknowledge.txt @@ -28,7 +28,7 @@ acknowledgment. Subscribe a user to the mailing list. >>> usermgr = config.db.user_manager - >>> from Mailman.constants import MemberRole + >>> from Mailman.interfaces import MemberRole >>> user_1 = usermgr.create_user('aperson@example.com') >>> address_1 = list(user_1.addresses)[0] >>> address_1.subscribe(mlist, MemberRole.member) diff --git a/Mailman/docs/addresses.txt b/Mailman/docs/addresses.txt index d38bad34b..4d4157f83 100644 --- a/Mailman/docs/addresses.txt +++ b/Mailman/docs/addresses.txt @@ -153,9 +153,10 @@ Subscriptions Addresses get subscribed to mailing lists, not users. When the address is subscribed, a role is specified. - >>> address_5 = usermgr.create_address('eperson@example.com', 'Elly Person') + >>> address_5 = usermgr.create_address( + ... 'eperson@example.com', 'Elly Person') >>> mlist = config.db.list_manager.create('_xtext@example.com') - >>> from Mailman.constants import MemberRole + >>> from Mailman.interfaces import MemberRole >>> address_5.subscribe(mlist, MemberRole.owner) <Member: Elly Person <eperson@example.com> on _xtext@example.com as MemberRole.owner> diff --git a/Mailman/docs/avoid-duplicates.txt b/Mailman/docs/avoid-duplicates.txt index 26561e455..b14bdb5bf 100644 --- a/Mailman/docs/avoid-duplicates.txt +++ b/Mailman/docs/avoid-duplicates.txt @@ -16,9 +16,11 @@ recipients from the list of recipients that earlier handler modules Create some members we're going to use. - >>> from Mailman.constants import MemberRole - >>> address_a = config.db.user_manager.create_address('aperson@example.com') - >>> address_b = config.db.user_manager.create_address('bperson@example.com') + >>> from Mailman.interfaces import MemberRole + >>> address_a = config.db.user_manager.create_address( + ... 'aperson@example.com') + >>> address_b = config.db.user_manager.create_address( + ... 'bperson@example.com') >>> member_a = address_a.subscribe(mlist, MemberRole.member) >>> member_b = address_b.subscribe(mlist, MemberRole.member) >>> flush() diff --git a/Mailman/docs/calc-recips.txt b/Mailman/docs/calc-recips.txt index 381527efb..e2a01fa8a 100644 --- a/Mailman/docs/calc-recips.txt +++ b/Mailman/docs/calc-recips.txt @@ -27,7 +27,7 @@ start out with. First, create a bunch of addresses... ...then subscribe these addresses to the mailing list as members... - >>> from Mailman.constants import MemberRole + >>> from Mailman.interfaces import MemberRole >>> member_a = address_a.subscribe(mlist, MemberRole.member) >>> member_b = address_b.subscribe(mlist, MemberRole.member) >>> member_c = address_c.subscribe(mlist, MemberRole.member) diff --git a/Mailman/docs/file-recips.txt b/Mailman/docs/file-recips.txt index 8561409b6..eab202eb3 100644 --- a/Mailman/docs/file-recips.txt +++ b/Mailman/docs/file-recips.txt @@ -83,8 +83,9 @@ However, if the sender of the original message is a member of the list and their address is in the include file, the sender's address is /not/ included in the recipients list. - >>> from Mailman.constants import MemberRole - >>> address_1 = config.db.user_manager.create_address('cperson@example.com') + >>> from Mailman.interfaces import MemberRole + >>> address_1 = config.db.user_manager.create_address( + ... 'cperson@example.com') >>> address_1.subscribe(mlist, MemberRole.member) <Member: cperson@example.com on _xtest@example.com as MemberRole.member> >>> flush() diff --git a/Mailman/docs/membership.txt b/Mailman/docs/membership.txt index 6c0a209e7..414012bc3 100644 --- a/Mailman/docs/membership.txt +++ b/Mailman/docs/membership.txt @@ -76,7 +76,7 @@ no users in the user database yet. We can add Anne as an owner of the mailing list, by creating a member role for her. - >>> from Mailman.constants import MemberRole + >>> from Mailman.interfaces import MemberRole >>> address_1 = list(user_1.addresses)[0] >>> address_1.address 'aperson@example.com' diff --git a/Mailman/docs/reply-to.txt b/Mailman/docs/reply-to.txt index 6ab477f79..a937ced8f 100644 --- a/Mailman/docs/reply-to.txt +++ b/Mailman/docs/reply-to.txt @@ -41,7 +41,7 @@ A list can be configured to add a Reply-To header pointing back to the mailing list's posting address. If there's no Reply-To header in the original message, the list's posting address simply gets inserted. - >>> from Mailman.constants import ReplyToMunging + >>> from Mailman.interfaces import ReplyToMunging >>> mlist.reply_goes_to_list = ReplyToMunging.point_to_list >>> mlist.preferred_language = 'en' >>> mlist.description = '' diff --git a/Mailman/docs/requests.txt b/Mailman/docs/requests.txt index 00128c358..cf11c3653 100644 --- a/Mailman/docs/requests.txt +++ b/Mailman/docs/requests.txt @@ -252,7 +252,7 @@ We can also hold a message with some additional metadata. Once held, the moderator can select one of several dispositions. The most trivial is to simply defer a decision for now. - >>> from Mailman.constants import Action + >>> from Mailman.interfaces import Action >>> moderator.handle_message(mlist, id_1, Action.defer) >>> flush() >>> requests.get_request(id_1) is not None @@ -427,7 +427,7 @@ subscription must be provided, including the subscriber's address and real name, their password (possibly hashed), what kind of delivery option they are chosing and their preferred language. - >>> from Mailman.constants import DeliveryMode + >>> from Mailman.interfaces import DeliveryMode >>> mlist.admin_immed_notify = False >>> flush() >>> id_3 = moderator.hold_subscription(mlist, @@ -710,7 +710,7 @@ unsubscription holds can send the list's moderators an immediate notification. >>> mlist.admin_immed_notify = False >>> flush() - >>> from Mailman.constants import MemberRole + >>> from Mailman.interfaces import MemberRole >>> user_1 = config.db.user_manager.create_user('gperson@example.com') >>> flush() >>> address_1 = list(user_1.addresses)[0] diff --git a/Mailman/interfaces/action.py b/Mailman/interfaces/action.py new file mode 100644 index 000000000..ea8b01d6e --- /dev/null +++ b/Mailman/interfaces/action.py @@ -0,0 +1,31 @@ +# Copyright (C) 2006-2007 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 +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# 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. + +__all__ = [ + 'Action', + ] + +from munepy import Enum + + + +class Action(Enum): + hold = 0 + reject = 1 + discard = 2 + accept = 3 + defer = 4 diff --git a/Mailman/interfaces/mailinglist.py b/Mailman/interfaces/mailinglist.py index 0bb176b96..d52a6f7b5 100644 --- a/Mailman/interfaces/mailinglist.py +++ b/Mailman/interfaces/mailinglist.py @@ -17,10 +17,26 @@ """Interface for a mailing list.""" +__all__ = [ + 'IMailingList', + 'ReplyToMunging', + ] + +from munepy import Enum from zope.interface import Interface, Attribute +class ReplyToMunging(Enum): + # The Reply-To header is passed through untouched + no_munging = 0 + # The mailing list's posting address is appended to the Reply-To header + point_to_list = 1 + # An explicit Reply-To header is added + explicit_header = 2 + + + class IMailingList(Interface): """A mailing list.""" diff --git a/Mailman/interfaces/member.py b/Mailman/interfaces/member.py index 9921f7dab..18f0b034e 100644 --- a/Mailman/interfaces/member.py +++ b/Mailman/interfaces/member.py @@ -18,8 +18,49 @@ """Interface describing the basics of a member.""" +from munepy import Enum from zope.interface import Interface, Attribute +__all__ = [ + 'DeliveryMode', + 'DeliveryStatus', + 'IMember', + 'MemberRole', + ] + + + +class DeliveryMode(Enum): + # Regular (i.e. non-digest) delivery + regular = 1 + # Plain text digest delivery + plaintext_digests = 2 + # MIME digest delivery + mime_digests = 3 + # Summary digests + summary_digests = 4 + + + +class DeliveryStatus(Enum): + # Delivery is enabled + enabled = 1 + # Delivery was disabled by the user + by_user = 2 + # Delivery was disabled due to bouncing addresses + by_bounces = 3 + # Delivery was disabled by an administrator or moderator + by_moderator = 4 + # Disabled for unknown reasons. + unknown = 5 + + + +class MemberRole(Enum): + member = 1 + owner = 2 + moderator = 3 + class IMember(Interface): |
