diff options
Diffstat (limited to 'src/mailman/model/docs/listmanager.rst')
| -rw-r--r-- | src/mailman/model/docs/listmanager.rst | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/src/mailman/model/docs/listmanager.rst b/src/mailman/model/docs/listmanager.rst index 8ff6ad3b0..234394ac6 100644 --- a/src/mailman/model/docs/listmanager.rst +++ b/src/mailman/model/docs/listmanager.rst @@ -16,7 +16,7 @@ Creating a mailing list Creating the list returns the newly created IMailList object. >>> from mailman.interfaces.mailinglist import IMailingList - >>> mlist = list_manager.create('test@example.com') + >>> mlist = list_manager.create('ant@example.com') >>> IMailingList.providedBy(mlist) True @@ -26,13 +26,13 @@ mailing list moves to a different host, so it is what uniquely distinguishes the mailing list to the system. >>> print(mlist.list_name) - test + ant >>> print(mlist.mail_host) example.com >>> print(mlist.fqdn_listname) - test@example.com + ant@example.com >>> print(mlist.list_id) - test.example.com + ant.example.com Deleting a mailing list @@ -46,9 +46,9 @@ Use the list manager to delete a mailing list. After deleting the list, you can create it again. - >>> mlist = list_manager.create('test@example.com') + >>> mlist = list_manager.create('ant@example.com') >>> print(mlist.fqdn_listname) - test@example.com + ant@example.com Retrieving a mailing list @@ -57,21 +57,29 @@ Retrieving a mailing list When a mailing list exists, you can ask the list manager for it and you will always get the same object back. - >>> mlist_2 = list_manager.get('test@example.com') - >>> mlist_2 is mlist - True + >>> list_manager.get('ant@example.com') + <mailing list "ant@example.com" at ...> -You can also get a mailing list by it's list id. +The ``.get()`` method is ambidextrous, so it also accepts ``List-ID``s. - >>> mlist_2 = list_manager.get_by_list_id('test.example.com') - >>> mlist_2 is mlist - True + >>> list_manager.get('ant.example.com') + <mailing list "ant@example.com" at ...> + +You can get a mailing list specifically by its ``List-ID``. + + >>> list_manager.get_by_list_id('ant.example.com') + <mailing list "ant@example.com" at ...> + +And you can get a mailing list specifically by its fully-qualified list name. + + >>> list_manager.get_by_fqdn('ant@example.com') + <mailing list "ant@example.com" at ...> If you try to get a list that doesn't existing yet, you get ``None``. - >>> print(list_manager.get('test_2@example.com')) + >>> print(list_manager.get('bee@example.com')) None - >>> print(list_manager.get_by_list_id('test_2.example.com')) + >>> print(list_manager.get_by_list_id('bee.example.com')) None You also get ``None`` if the list name is invalid. @@ -88,33 +96,33 @@ iterate over the mailing list objects, the list posting addresses, or the list address components. :: - >>> mlist_3 = list_manager.create('test_3@example.com') - >>> mlist_4 = list_manager.create('test_4@example.com') + >>> mlist_3 = list_manager.create('cat@example.com') + >>> mlist_4 = list_manager.create('dog@example.com') >>> for name in sorted(list_manager.names): ... print(name) - test@example.com - test_3@example.com - test_4@example.com + ant@example.com + cat@example.com + dog@example.com >>> for list_id in sorted(list_manager.list_ids): ... print(list_id) - test.example.com - test_3.example.com - test_4.example.com + ant.example.com + cat.example.com + dog.example.com >>> for fqdn_listname in sorted(m.fqdn_listname ... for m in list_manager.mailing_lists): ... print(fqdn_listname) - test@example.com - test_3@example.com - test_4@example.com + ant@example.com + cat@example.com + dog@example.com >>> for list_name, mail_host in sorted(list_manager.name_components): ... print(list_name, '@', mail_host) - test @ example.com - test_3 @ example.com - test_4 @ example.com + ant @ example.com + cat @ example.com + dog @ example.com .. _`RFC 2369`: http://www.faqs.org/rfcs/rfc2369.html |
