diff options
| author | Barry Warsaw | 2012-03-15 15:48:41 -0700 |
|---|---|---|
| committer | Barry Warsaw | 2012-03-15 15:48:41 -0700 |
| commit | ac0f1c3916e797f3a2261e9a2631e496fb90a8f1 (patch) | |
| tree | 441a8e2b32de59f466a837f072120c36c92f60d4 /src/mailman/commands | |
| parent | 0589c867988dc70cbe83a53bc9d1e2bbf3108b82 (diff) | |
| download | mailman-ac0f1c3916e797f3a2261e9a2631e496fb90a8f1.tar.gz mailman-ac0f1c3916e797f3a2261e9a2631e496fb90a8f1.tar.zst mailman-ac0f1c3916e797f3a2261e9a2631e496fb90a8f1.zip | |
Schema change. After discussion at Pycon, we decided to change "real_name" to
"display_name" across the board.
* `IMailingList.real_name` -> `IMailingList.display_name`
* `IUser.real_name` -> `IUser.display_name`
* `IAddress.real_name` -> `IAddress.display_name`
* Schema changes:
- real_name -> display_name (mailinglist, user, address)
Diffstat (limited to 'src/mailman/commands')
| -rw-r--r-- | src/mailman/commands/cli_lists.py | 2 | ||||
| -rw-r--r-- | src/mailman/commands/cli_members.py | 18 | ||||
| -rw-r--r-- | src/mailman/commands/cli_withlist.py | 4 | ||||
| -rw-r--r-- | src/mailman/commands/docs/import.rst | 4 | ||||
| -rw-r--r-- | src/mailman/commands/docs/membership.rst | 2 | ||||
| -rw-r--r-- | src/mailman/commands/docs/withlist.rst | 18 | ||||
| -rw-r--r-- | src/mailman/commands/eml_membership.py | 8 |
7 files changed, 29 insertions, 27 deletions
diff --git a/src/mailman/commands/cli_lists.py b/src/mailman/commands/cli_lists.py index 42e67e3a8..5629f33c1 100644 --- a/src/mailman/commands/cli_lists.py +++ b/src/mailman/commands/cli_lists.py @@ -109,7 +109,7 @@ class Lists: for mlist in mailing_lists: if args.names: identifier = '{0} [{1}]'.format( - mlist.fqdn_listname, mlist.real_name) + mlist.fqdn_listname, mlist.display_name) else: identifier = mlist.fqdn_listname longest = max(len(identifier), longest) diff --git a/src/mailman/commands/cli_members.py b/src/mailman/commands/cli_members.py index f37fb6ecb..2bf6be848 100644 --- a/src/mailman/commands/cli_members.py +++ b/src/mailman/commands/cli_members.py @@ -17,7 +17,7 @@ """The 'members' subcommand.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -155,7 +155,7 @@ class Members: try: addresses = list(mlist.members.addresses) if len(addresses) == 0: - print >> fp, mlist.fqdn_listname, 'has no members' + print(mlist.fqdn_listname, 'has no members', file=fp) return for address in sorted(addresses, key=attrgetter('email')): if args.regular: @@ -170,8 +170,9 @@ class Members: member = mlist.members.get_member(address.email) if member.delivery_status not in status_types: continue - print >> fp, formataddr( - (address.real_name, address.original_email)) + print( + formataddr((address.display_name, address.original_email)), + file=fp) finally: if fp is not sys.stdout: fp.close() @@ -194,19 +195,20 @@ class Members: if line.startswith('#') or len(line.strip()) == 0: continue # Parse the line and ensure that the values are unicodes. - real_name, email = parseaddr(line) - real_name = real_name.decode(fp.encoding) + display_name, email = parseaddr(line) + display_name = display_name.decode(fp.encoding) email = email.decode(fp.encoding) # Give the user a default, user-friendly password. password = generate(int(config.passwords.password_length)) try: - add_member(mlist, email, real_name, password, + add_member(mlist, email, display_name, password, DeliveryMode.regular, mlist.preferred_language.code) except AlreadySubscribedError: # It's okay if the address is already subscribed, just # print a warning and continue. - print 'Already subscribed (skipping):', email, real_name + print('Already subscribed (skipping):', + email, display_name) finally: if fp is not sys.stdin: fp.close() diff --git a/src/mailman/commands/cli_withlist.py b/src/mailman/commands/cli_withlist.py index 3b1b36b1a..55d9ff5ec 100644 --- a/src/mailman/commands/cli_withlist.py +++ b/src/mailman/commands/cli_withlist.py @@ -230,8 +230,8 @@ As another example, say you wanted to change the display name for a particular mailing list. You could put the following function in a file called 'change.pw': - def change(mlist, real_name): - mlist.real_name = real_name + def change(mlist, display_name): + mlist.display_name = display_name # Required to save changes to the database. commit() diff --git a/src/mailman/commands/docs/import.rst b/src/mailman/commands/docs/import.rst index 1092063a4..2ab6f99bd 100644 --- a/src/mailman/commands/docs/import.rst +++ b/src/mailman/commands/docs/import.rst @@ -48,9 +48,9 @@ import, the mailing list's 'real name' has changed. >>> FakeArgs.pickle_file = [ ... resource_filename('mailman.testing', 'config.pck')] - >>> print mlist.real_name + >>> print mlist.display_name Import >>> command.process(FakeArgs) - >>> print mlist.real_name + >>> print mlist.display_name Test diff --git a/src/mailman/commands/docs/membership.rst b/src/mailman/commands/docs/membership.rst index f9d3aacd0..638705e91 100644 --- a/src/mailman/commands/docs/membership.rst +++ b/src/mailman/commands/docs/membership.rst @@ -157,7 +157,7 @@ list. <BLANKLINE> >>> user = user_manager.get_user('anne@example.com') - >>> print user.real_name + >>> print user.display_name Anne Person >>> list(user.addresses) [<Address: Anne Person <anne@example.com> [verified] at ...>] diff --git a/src/mailman/commands/docs/withlist.rst b/src/mailman/commands/docs/withlist.rst index f00208490..99a366c9a 100644 --- a/src/mailman/commands/docs/withlist.rst +++ b/src/mailman/commands/docs/withlist.rst @@ -54,8 +54,8 @@ single argument, the mailing list. ... def showme(mailing_list): ... print "The list's name is", mailing_list.fqdn_listname ... - ... def realname(mailing_list): - ... print "The list's real name is", mailing_list.real_name + ... def displayname(mailing_list): + ... print "The list's display name is", mailing_list.display_name ... """ If the name of the function is the same as the module, then you only need to @@ -71,9 +71,9 @@ name the function once. The function's name can also be different than the modules name. In that case, just give the full module path name to the function you want to call. - >>> args.run = 'showme.realname' + >>> args.run = 'showme.displayname' >>> command.process(args) - The list's real name is Aardvark + The list's display name is Aardvark Multiple lists @@ -89,14 +89,14 @@ must start with a caret. >>> args.listname = '^.*example.com' >>> command.process(args) - The list's real name is Aardvark - The list's real name is Badger - The list's real name is Badboys + The list's display name is Aardvark + The list's display name is Badger + The list's display name is Badboys >>> args.listname = '^bad.*' >>> command.process(args) - The list's real name is Badger - The list's real name is Badboys + The list's display name is Badger + The list's display name is Badboys >>> args.listname = '^foo' >>> command.process(args) diff --git a/src/mailman/commands/eml_membership.py b/src/mailman/commands/eml_membership.py index 386316eb9..d6f7a47d9 100644 --- a/src/mailman/commands/eml_membership.py +++ b/src/mailman/commands/eml_membership.py @@ -65,7 +65,7 @@ used. delivery_mode = self._parse_arguments(arguments, results) if delivery_mode is ContinueProcessing.no: return ContinueProcessing.no - real_name, address = parseaddr(msg['from']) + display_name, address = parseaddr(msg['from']) # Address could be None or the empty string. if not address: address = msg.sender @@ -81,7 +81,7 @@ used. return ContinueProcessing.yes joins.add(address) results.joins = joins - person = formataddr((real_name, address)) + person = formataddr((display_name, address)) # Is this person already a member of the list? Search for all # matching memberships. members = getUtility(ISubscriptionService).find_members( @@ -90,7 +90,7 @@ used. print(_('$person is already a member'), file=results) else: getUtility(IRegistrar).register(mlist, address, - real_name, delivery_mode) + display_name, delivery_mode) print(_('Confirmation email sent to $person'), file=results) return ContinueProcessing.yes @@ -177,7 +177,7 @@ You may be asked to confirm your request.""") file=results) return ContinueProcessing.no member.unsubscribe() - person = formataddr((user.real_name, email)) + person = formataddr((user.display_name, email)) print(_('$person left $mlist.fqdn_listname'), file=results) return ContinueProcessing.yes |
