diff options
| author | Barry Warsaw | 2007-11-07 20:56:43 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2007-11-07 20:56:43 -0500 |
| commit | 38e50b70ca523bd02f038db2d71da0277f8ee0aa (patch) | |
| tree | 7c76f652c8ba05873fa1fe19d20a09288c27fc01 | |
| parent | 1d4fe92ee5e739a40c88ad4221675de4485f653c (diff) | |
| download | mailman-38e50b70ca523bd02f038db2d71da0277f8ee0aa.tar.gz mailman-38e50b70ca523bd02f038db2d71da0277f8ee0aa.tar.zst mailman-38e50b70ca523bd02f038db2d71da0277f8ee0aa.zip | |
Fix two more doctests
| -rw-r--r-- | Mailman/Message.py | 4 | ||||
| -rw-r--r-- | Mailman/docs/approve.txt | 58 | ||||
| -rw-r--r-- | Mailman/docs/archives.txt | 33 | ||||
| -rw-r--r-- | Mailman/docs/avoid-duplicates.txt | 40 | ||||
| -rw-r--r-- | Mailman/docs/bounces.txt | 10 | ||||
| -rw-r--r-- | Mailman/docs/calc-recips.txt | 11 | ||||
| -rw-r--r-- | Mailman/docs/cleanse.txt | 11 | ||||
| -rw-r--r-- | Mailman/docs/cook-headers.txt | 42 | ||||
| -rw-r--r-- | Mailman/docs/decorate.txt | 10 | ||||
| -rw-r--r-- | Mailman/docs/digests.txt | 14 | ||||
| -rw-r--r-- | Mailman/docs/file-recips.txt | 9 | ||||
| -rw-r--r-- | Mailman/docs/filtering.txt | 24 | ||||
| -rw-r--r-- | Mailman/docs/hold.txt | 27 | ||||
| -rw-r--r-- | Mailman/docs/lifecycle.txt | 7 | ||||
| -rw-r--r-- | Mailman/docs/listmanager.txt | 13 | ||||
| -rw-r--r-- | Mailman/docs/membership.txt | 9 | ||||
| -rw-r--r-- | Mailman/docs/message.txt | 2 | ||||
| -rw-r--r-- | Mailman/docs/messagestore.txt | 4 | ||||
| -rw-r--r-- | Mailman/docs/news-runner.txt | 13 | ||||
| -rw-r--r-- | Mailman/docs/nntp.txt | 9 | ||||
| -rw-r--r-- | Mailman/docs/outgoing.txt | 9 | ||||
| -rw-r--r-- | Mailman/docs/pending.txt | 10 | ||||
| -rw-r--r-- | Mailman/docs/registration.txt | 18 | ||||
| -rw-r--r-- | Mailman/docs/reply-to.txt | 10 |
24 files changed, 108 insertions, 289 deletions
diff --git a/Mailman/Message.py b/Mailman/Message.py index 5e05892b6..1ce654ba4 100644 --- a/Mailman/Message.py +++ b/Mailman/Message.py @@ -51,6 +51,10 @@ class Message(email.message.Message): return unicode(value, 'ascii') return value + def get_all(self, name, failobj=None): + all_values = email.message.Message.get_all(self, name, failobj) + return [unicode(value, 'ascii') for value in all_values] + # BAW: For debugging w/ bin/dumpdb. Apparently pprint uses repr. def __repr__(self): return self.__str__() diff --git a/Mailman/docs/approve.txt b/Mailman/docs/approve.txt index cd928e187..56afc1dd4 100644 --- a/Mailman/docs/approve.txt +++ b/Mailman/docs/approve.txt @@ -9,14 +9,13 @@ approval queue. This has several use cases: - An automated script can be programmed to send a message to an otherwise moderated list. - + In order to support this, a mailing list can be given a 'moderator password' which is shared among all the administrators. >>> from Mailman.Handlers.Approve import process - >>> from Mailman.database import flush >>> from Mailman.configuration import config - >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> mlist = config.db.list_manager.create(u'_xtest@example.com') Short circuiting @@ -25,13 +24,11 @@ Short circuiting The message may have been approved by some other means, as evident in the message metadata. In this case, the handler returns immediately. - >>> from email import message_from_string - >>> from Mailman.Message import Message - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... From: aperson@example.com ... ... An important message. - ... """, Message) + ... """) >>> msgdata = {'approved': True} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -51,9 +48,8 @@ gets sent through with no further posting moderation. The Approved header is not stripped in this handler module, but instead in the Cleanse module. This ensures that no moderator approval password in the headers will leak out. - >>> mlist.moderator_password = 'abcxyz' - >>> flush() - >>> msg['Approved'] = 'abcxyz' + >>> mlist.moderator_password = u'abcxyz' + >>> msg['Approved'] = u'abcxyz' >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -69,7 +65,7 @@ But if the wrong password is given, then the message is not marked as being approved. The header is still removed though. >>> del msg['Approved'] - >>> msg['Approved'] = '123456' + >>> msg['Approved'] = u'123456' >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -85,7 +81,7 @@ In the spirit of being liberal in what you accept, using an Approve header is completely synonymous. >>> del msg['Approved'] - >>> msg['Approve'] = 'abcxyz' + >>> msg['Approve'] = u'abcxyz' >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -98,7 +94,7 @@ completely synonymous. [('adminapproved', True), ('approved', True)] >>> del msg['Approve'] - >>> msg['Approve'] = '123456' + >>> msg['Approve'] = u'123456' >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -120,12 +116,12 @@ using a 'pseudo-header', which is really just the first non-whitespace line in the payload of the message of the message. If this pseudo-header looks like a matching Approve or Approved header, the message is similarly allowed to pass. - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... From: aperson@example.com ... ... Approved: abcxyz ... An important message. - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -139,12 +135,12 @@ matching Approve or Approved header, the message is similarly allowed to pass. >>> sorted(msgdata.items()) [('adminapproved', True), ('approved', True)] - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... From: aperson@example.com ... ... Approve: abcxyz ... An important message. - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -161,12 +157,12 @@ matching Approve or Approved header, the message is similarly allowed to pass. As before, a mismatch in the pseudo-header does not approve the message, but the pseudo-header line is still removed. - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... From: aperson@example.com ... ... Approved: 123456 ... An important message. - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -180,12 +176,12 @@ the pseudo-header line is still removed. >>> msgdata {} - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... From: aperson@example.com ... ... Approve: 123456 ... An important message. - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -207,7 +203,7 @@ Mailman searches for the pseudo-header as the first non-whitespace line in the first text/plain message part of the message. This allows the feature to be used with MIME documents. - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... From: aperson@example.com ... MIME-Version: 1.0 ... Content-Type: multipart/mixed; boundary="AAA" @@ -224,7 +220,7 @@ used with MIME documents. ... Approved: abcxyz ... An important message. ... --AAA-- - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -249,7 +245,7 @@ used with MIME documents. >>> sorted(msgdata.items()) [('adminapproved', True), ('approved', True)] - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... From: aperson@example.com ... MIME-Version: 1.0 ... Content-Type: multipart/mixed; boundary="AAA" @@ -266,7 +262,7 @@ used with MIME documents. ... Approve: abcxyz ... An important message. ... --AAA-- - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -293,7 +289,7 @@ used with MIME documents. Here, the correct password is in the non-text/plain part, so it is ignored. - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... From: aperson@example.com ... MIME-Version: 1.0 ... Content-Type: multipart/mixed; boundary="AAA" @@ -310,7 +306,7 @@ Here, the correct password is in the non-text/plain part, so it is ignored. ... Approve: 123456 ... An important message. ... --AAA-- - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -334,7 +330,7 @@ Here, the correct password is in the non-text/plain part, so it is ignored. >>> msgdata {} - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... From: aperson@example.com ... MIME-Version: 1.0 ... Content-Type: multipart/mixed; boundary="AAA" @@ -351,7 +347,7 @@ Here, the correct password is in the non-text/plain part, so it is ignored. ... Approve: 123456 ... An important message. ... --AAA-- - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -375,7 +371,7 @@ Here, the correct password is in the non-text/plain part, so it is ignored. >>> msgdata {} - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... From: aperson@example.com ... MIME-Version: 1.0 ... Content-Type: multipart/mixed; boundary="AAA" @@ -392,7 +388,7 @@ Here, the correct password is in the non-text/plain part, so it is ignored. ... Approved: 123456 ... An important message. ... --AAA-- - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() diff --git a/Mailman/docs/archives.txt b/Mailman/docs/archives.txt index a02fdf802..cad602634 100644 --- a/Mailman/docs/archives.txt +++ b/Mailman/docs/archives.txt @@ -8,14 +8,10 @@ archivers to work in a separate process from the main Mailman delivery processes. >>> from Mailman.Handlers.ToArchive import process - >>> from Mailman.Message import Message >>> from Mailman.queue import Switchboard >>> from Mailman.configuration import config - >>> from Mailman.database import flush - >>> from email import message_from_string - >>> mlist = config.db.list_manager.create('_xtest@example.com') - >>> mlist.preferred_language = 'en' - >>> flush() + >>> mlist = config.db.list_manager.create(u'_xtest@example.com') + >>> mlist.preferred_language = u'en' >>> switchboard = Switchboard(config.ARCHQUEUE_DIR) A helper function. @@ -33,12 +29,11 @@ message should /not/ get archived. For example, no digests should ever get archived. >>> mlist.archive = True - >>> flush() - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... Subject: A sample message ... ... A message of great import. - ... """, Message) + ... """) >>> process(mlist, msg, dict(isdigest=True)) >>> switchboard.files [] @@ -47,7 +42,6 @@ If the mailing list is not configured to archive, then even regular deliveries won't be archived. >>> mlist.archive = False - >>> flush() >>> process(mlist, msg, {}) >>> switchboard.files [] @@ -58,25 +52,24 @@ X-No-Archive: header can be used to indicate that the message should not be archived. Confusingly, this header's value is actually ignored. >>> mlist.archive = True - >>> flush() >>> msg = message_from_string("""\ ... Subject: A sample message ... X-No-Archive: YES ... ... A message of great import. - ... """, Message) + ... """) >>> process(mlist, msg, dict(isdigest=True)) >>> switchboard.files [] Even a 'no' value will stop the archiving of the message. - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... Subject: A sample message ... X-No-Archive: No ... ... A message of great import. - ... """, Message) + ... """) >>> process(mlist, msg, dict(isdigest=True)) >>> switchboard.files [] @@ -84,24 +77,24 @@ Even a 'no' value will stop the archiving of the message. Another header that's been observed is the X-Archive: header. Here, the header's case folded value must be 'no' in order to prevent archiving. - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... Subject: A sample message ... X-Archive: No ... ... A message of great import. - ... """, Message) + ... """) >>> process(mlist, msg, dict(isdigest=True)) >>> switchboard.files [] But if the value is 'yes', then the message will be archived. - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... Subject: A sample message ... X-Archive: Yes ... ... A message of great import. - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> len(switchboard.files) 1 @@ -120,11 +113,11 @@ But if the value is 'yes', then the message will be archived. Without either archiving header, and all other things being the same, the message will get archived. - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... Subject: A sample message ... ... A message of great import. - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> len(switchboard.files) 1 diff --git a/Mailman/docs/avoid-duplicates.txt b/Mailman/docs/avoid-duplicates.txt index b14bdb5bf..6a1b46f77 100644 --- a/Mailman/docs/avoid-duplicates.txt +++ b/Mailman/docs/avoid-duplicates.txt @@ -6,27 +6,22 @@ reduce the reception of duplicate messages. It does this by removing certain recipients from the list of recipients that earlier handler modules (e.g. CalcRecips) calculates. - >>> from email import message_from_string - >>> from Mailman.Message import Message >>> from Mailman.Handlers.AvoidDuplicates import process >>> from Mailman.configuration import config - >>> from Mailman.database import flush - >>> mlist = config.db.list_manager.create('_xtest@example.com') - >>> flush() + >>> mlist = config.db.list_manager.create(u'_xtest@example.com') Create some members we're going to use. >>> from Mailman.interfaces import MemberRole >>> address_a = config.db.user_manager.create_address( - ... 'aperson@example.com') + ... u'aperson@example.com') >>> address_b = config.db.user_manager.create_address( - ... 'bperson@example.com') + ... u'bperson@example.com') >>> member_a = address_a.subscribe(mlist, MemberRole.member) >>> member_b = address_b.subscribe(mlist, MemberRole.member) - >>> flush() >>> # This is the message metadata dictionary as it would be produced by >>> # the CalcRecips handler. - >>> recips = dict(recips=['aperson@example.com', 'bperson@example.com']) + >>> recips = dict(recips=[u'aperson@example.com', u'bperson@example.com']) Short circuiting @@ -39,7 +34,7 @@ The module short-circuits if there are no recipients. ... Subject: A message of great import ... ... Something - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> msgdata @@ -62,16 +57,15 @@ one of the recipient headers (i.e. To, CC, Resent-To, or Resent-CC), then they will get a list copy. >>> member_a.preferences.receive_list_copy = False - >>> flush() >>> msg = message_from_string("""\ ... From: Claire Person <cperson@example.com> ... ... Something of great import. - ... """, Message) + ... """) >>> msgdata = recips.copy() >>> process(mlist, msg, msgdata) >>> sorted(msgdata['recips']) - ['aperson@example.com', 'bperson@example.com'] + [u'aperson@example.com', u'bperson@example.com'] >>> print msg.as_string() From: Claire Person <cperson@example.com> <BLANKLINE> @@ -85,11 +79,11 @@ If they're mentioned on the CC line, they won't get a list copy. ... CC: aperson@example.com ... ... Something of great import. - ... """, Message) + ... """) >>> msgdata = recips.copy() >>> process(mlist, msg, msgdata) >>> sorted(msgdata['recips']) - ['bperson@example.com'] + [u'bperson@example.com'] >>> print msg.as_string() From: Claire Person <cperson@example.com> CC: aperson@example.com @@ -105,11 +99,11 @@ But if they're mentioned on the CC line and have receive_list_copy set to True ... CC: bperson@example.com ... ... Something of great import. - ... """, Message) + ... """) >>> msgdata = recips.copy() >>> process(mlist, msg, msgdata) >>> sorted(msgdata['recips']) - ['aperson@example.com', 'bperson@example.com'] + [u'aperson@example.com', u'bperson@example.com'] >>> print msg.as_string() From: Claire Person <cperson@example.com> CC: bperson@example.com @@ -124,11 +118,11 @@ Other headers checked for recipients include the To... ... To: aperson@example.com ... ... Something of great import. - ... """, Message) + ... """) >>> msgdata = recips.copy() >>> process(mlist, msg, msgdata) >>> sorted(msgdata['recips']) - ['bperson@example.com'] + [u'bperson@example.com'] >>> print msg.as_string() From: Claire Person <cperson@example.com> To: aperson@example.com @@ -143,11 +137,11 @@ Other headers checked for recipients include the To... ... Resent-To: aperson@example.com ... ... Something of great import. - ... """, Message) + ... """) >>> msgdata = recips.copy() >>> process(mlist, msg, msgdata) >>> sorted(msgdata['recips']) - ['bperson@example.com'] + [u'bperson@example.com'] >>> print msg.as_string() From: Claire Person <cperson@example.com> Resent-To: aperson@example.com @@ -162,11 +156,11 @@ Other headers checked for recipients include the To... ... Resent-Cc: aperson@example.com ... ... Something of great import. - ... """, Message) + ... """) >>> msgdata = recips.copy() >>> process(mlist, msg, msgdata) >>> sorted(msgdata['recips']) - ['bperson@example.com'] + [u'bperson@example.com'] >>> print msg.as_string() From: Claire Person <cperson@example.com> Resent-Cc: aperson@example.com diff --git a/Mailman/docs/bounces.txt b/Mailman/docs/bounces.txt index 7195a082f..fa0d44ce9 100644 --- a/Mailman/docs/bounces.txt +++ b/Mailman/docs/bounces.txt @@ -14,22 +14,18 @@ essentially equivalent to rejecting the message with notification. Mailing lists can bounce a message with an optional error message. >>> from Mailman.configuration import config - >>> from Mailman.database import flush - >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> mlist = config.db.list_manager.create(u'_xtest@example.com') >>> mlist.preferred_language = u'en' - >>> flush() Any message can be bounced. - >>> from email import message_from_string - >>> from Mailman.Message import Message - >>> msg = message_from_string("""\ + >>> msg = message_from_string(u"""\ ... To: _xtest@example.com ... From: aperson@example.com ... Subject: Something important ... ... I sometimes say something important. - ... """, Message) + ... """) Bounce a message by passing in the original message, and an optional error message. The bounced message ends up in the virgin queue, awaiting sending diff --git a/Mailman/docs/calc-recips.txt b/Mailman/docs/calc-recips.txt index e2a01fa8a..6fe09fa81 100644 --- a/Mailman/docs/calc-recips.txt +++ b/Mailman/docs/calc-recips.txt @@ -5,14 +5,9 @@ Every message that makes it through to the list membership gets sent to a set of recipient addresses. These addresses are calculated by one of the handler modules and depends on a host of factors. - >>> from email import message_from_string - >>> from Mailman.Message import Message >>> from Mailman.Handlers.CalcRecips import process >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> mlist = config.db.list_manager.create('_xtest@example.com') - >>> flush() - Recipients are calculate from the list members, so add a bunch of members to start out with. First, create a bunch of addresses... @@ -41,7 +36,6 @@ start out with. First, create a bunch of addresses... >>> member_d.preferences.delivery_mode = DeliveryMode.plaintext_digests >>> member_e.preferences.delivery_mode = DeliveryMode.mime_digests >>> member_f.preferences.delivery_mode = DeliveryMode.summary_digests - >>> flush() Short-circuiting @@ -55,7 +49,7 @@ but not all of the recipients. ... From: Xavier Person <xperson@example.com> ... ... Something of great import. - ... """, Message) + ... """) >>> recips = set(('qperson@example.com', 'zperson@example.com')) >>> msgdata = dict(recips=recips) >>> process(mlist, msg, msgdata) @@ -77,12 +71,11 @@ soon as they are posted. In other words, these folks are not digest members. Members can elect not to receive a list copy of their own postings. >>> member_c.preferences.receive_own_postings = False - >>> flush() >>> msg = message_from_string("""\ ... From: Claire Person <cperson@example.com> ... ... Something of great import. - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> sorted(msgdata['recips']) diff --git a/Mailman/docs/cleanse.txt b/Mailman/docs/cleanse.txt index ce0a69b23..ecf452788 100644 --- a/Mailman/docs/cleanse.txt +++ b/Mailman/docs/cleanse.txt @@ -5,13 +5,9 @@ All messages posted to a list get their headers cleansed. Some headers are related to additional permissions that can be granted to the message and other headers can be used to fish for membership. - >>> from email import message_from_string - >>> from Mailman.Message import Message >>> from Mailman.Handlers.Cleanse import process >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> mlist = config.db.list_manager.create('_xtest@example.com') - >>> flush() Headers such as Approved, Approve, and Urgent are used to grant special pemissions to individual messages. All may contain a password; the first two @@ -28,7 +24,7 @@ headers contain passwords, they must be removed from any posted message. ... Subject: A message of great import ... ... Blah blah blah - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> print msg.as_string() From: aperson@example.com @@ -54,7 +50,7 @@ Pegasus mail. I don't remember what program uses X-Confirm-Reading-To though ... Subject: a message to you ... ... How are you doing? - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> print msg.as_string() From: bperson@example.com @@ -80,7 +76,6 @@ Hotmail apparently sets X-Originating-Email. >>> mlist.anonymous_list = True >>> mlist.description = u'A Test Mailing List' >>> mlist.preferred_language = u'en' - >>> flush() >>> msg = message_from_string("""\ ... From: bperson@example.com ... Reply-To: bperson@example.org @@ -89,7 +84,7 @@ Hotmail apparently sets X-Originating-Email. ... Subject: a message to you ... ... How are you doing? - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> print msg.as_string() Subject: a message to you diff --git a/Mailman/docs/cook-headers.txt b/Mailman/docs/cook-headers.txt index 62c80b186..a49519b13 100644 --- a/Mailman/docs/cook-headers.txt +++ b/Mailman/docs/cook-headers.txt @@ -7,11 +7,8 @@ transformations. Some headers get added, others get changed. Some of these changes depend on mailing list settings and others depend on how the message is getting sent through the system. We'll take things one-by-one. - >>> from email import message_from_string - >>> from Mailman.Message import Message >>> from Mailman.Handlers.CookHeaders import process >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> mlist.subject_prefix = u'' >>> mlist.include_list_post_header = False @@ -19,7 +16,6 @@ is getting sent through the system. We'll take things one-by-one. >>> # XXX This will almost certainly change once we've worked out the web >>> # space layout for mailing lists now. >>> mlist.web_page_url = 'http://lists.example.com/' - >>> flush() Saving the original sender @@ -32,7 +28,7 @@ will place the sender in the message metadata for safe keeping. ... From: aperson@example.com ... ... A message of great import. - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> msgdata['original_sender'] @@ -44,7 +40,7 @@ But if there was no original sender, then the empty string will be saved. ... Subject: No original sender ... ... A message of great import. - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> msgdata['original_sender'] @@ -62,7 +58,7 @@ mail loops. ... From: aperson@example.com ... ... A message of great import. - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> msg['x-beenthere'] '_xtest@example.com' @@ -75,7 +71,7 @@ original message, the posted message will contain two such headers. ... X-BeenThere: another@example.com ... ... A message of great import. - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> sorted(msg.get_all('x-beenthere')) ['_xtest@example.com', 'another@example.com'] @@ -90,7 +86,7 @@ Mailman will also insert an X-Mailman-Version header... ... From: aperson@example.com ... ... A message of great import. - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> from Mailman.Version import VERSION >>> msg['x-mailman-version'] == VERSION @@ -103,7 +99,7 @@ Mailman will also insert an X-Mailman-Version header... ... X-Mailman-Version: 3000 ... ... A message of great import. - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> from Mailman.Version import VERSION >>> msg['x-mailman-version'] @@ -121,7 +117,7 @@ message. ... From: aperson@example.com ... ... A message of great import. - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> from Mailman.Version import VERSION >>> msg['precedence'] @@ -135,7 +131,7 @@ have one of them. ... Precedence: junk ... ... A message of great import. - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> from Mailman.Version import VERSION >>> msg['precedence'] @@ -167,7 +163,7 @@ specific list (e.g. password reminders in Mailman 2.x). >>> msg = message_from_string("""\ ... From: aperson@example.com ... - ... """, Message) + ... """) >>> process(mlist, msg, dict(_nolist=True)) >>> list_headers(msg) ---start--- @@ -177,11 +173,10 @@ Some people don't like these headers because their mail readers aren't good about hiding them. A list owner can turn these headers off. >>> mlist.include_rfc2369_headers = False - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> list_headers(msg) ---start--- @@ -192,11 +187,10 @@ But normally, a list will include these headers. >>> mlist.include_rfc2369_headers = True >>> mlist.include_list_post_header = True >>> mlist.preferred_language = 'en' - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> list_headers(msg) ---start--- @@ -214,11 +208,10 @@ If the mailing list has a description, then it is included in the List-Id header. >>> mlist.description = 'My test mailing list' - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> list_headers(msg) ---start--- @@ -237,7 +230,7 @@ Administrative messages crafted by Mailman will have a reduced set of headers. >>> msg = message_from_string("""\ ... From: aperson@example.com ... - ... """, Message) + ... """) >>> process(mlist, msg, dict(reduced_list_headers=True)) >>> list_headers(msg) ---start--- @@ -254,11 +247,10 @@ With the normal set of List-* headers, it's still possible to suppress the List-Post header, which is reasonable for an announce only mailing list. >>> mlist.include_list_post_header = False - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> list_headers(msg) ---start--- @@ -276,11 +268,10 @@ List-Archive header either. >>> mlist.include_list_post_header = True >>> mlist.archive = False - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> list_headers(msg) ---start--- @@ -305,11 +296,10 @@ the recipient headers so that users will be able to reply back to the list. >>> from Mailman.interfaces import Personalization, ReplyToMunging >>> mlist.personalize = Personalization.full >>> mlist.reply_goes_to_list = ReplyToMunging.no_munging - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> print msg.as_string() From: aperson@example.com diff --git a/Mailman/docs/decorate.txt b/Mailman/docs/decorate.txt index bf0adddd7..df4d76451 100644 --- a/Mailman/docs/decorate.txt +++ b/Mailman/docs/decorate.txt @@ -5,12 +5,9 @@ Message decoration is the process of adding headers and footers to the original message. A handler module takes care of this based on the settings of the mailing list and the type of message being processed. - >>> from email import message_from_string >>> from Mailman.Handlers.Decorate import process >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> mlist = config.db.list_manager.create('_xtest@example.com') - >>> flush() >>> msg_text = """\ ... From: aperson@example.org ... @@ -52,7 +49,6 @@ header, and appended with the verbatim footer. >>> mlist.msg_header = 'header\n' >>> mlist.msg_footer = 'footer' >>> mlist.preferred_language = 'en' - >>> flush() >>> process(mlist, msg, {}) >>> print msg.as_string() From: aperson@example.org @@ -71,7 +67,6 @@ short descriptive name for the mailing list). >>> mlist.msg_header = '$real_name header\n' >>> mlist.msg_footer = '$real_name footer' >>> mlist.real_name = 'XTest' - >>> flush() >>> process(mlist, msg, {}) >>> print msg.as_string() From: aperson@example.org @@ -86,7 +81,6 @@ will remain in the header or footer unchanged. >>> msg = message_from_string(msg_text) >>> mlist.msg_header = '$dummy header\n' >>> mlist.msg_footer = '$dummy footer' - >>> flush() >>> process(mlist, msg, {}) >>> print msg.as_string() From: aperson@example.org @@ -112,7 +106,6 @@ message payload. >>> mlist.msg_header = 'header' >>> mlist.msg_footer = 'footer' >>> mlist.preferred_language = 'en' - >>> mlist.flush() >>> msg = message_from_string("""\ ... From: aperson@example.org ... Content-Type: text/plain; format=flowed; delsp=no @@ -143,7 +136,6 @@ convert the text to utf-8 and base-64 encode the message payload. >>> mlist.msg_header = '$description header' >>> mlist.msg_footer = '$description footer' >>> mlist.description = u'\u65e5\u672c\u8a9e' - >>> flush() >>> from email.message import Message >>> msg = Message() @@ -170,7 +162,6 @@ attachments. >>> mlist.preferred_language = 'en' >>> mlist.msg_header = 'header' >>> mlist.msg_footer = 'footer' - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.org ... Content-Type: text/plain; charset=unknown @@ -222,7 +213,6 @@ they were simply concatenated. >>> mlist.preferred_language = 'en' >>> mlist.msg_header = 'header' >>> mlist.msg_footer = 'footer' - >>> flush() >>> part_1 = message_from_string("""\ ... From: aperson@example.org ... diff --git a/Mailman/docs/digests.txt b/Mailman/docs/digests.txt index 4d787221d..72c34b372 100644 --- a/Mailman/docs/digests.txt +++ b/Mailman/docs/digests.txt @@ -7,18 +7,14 @@ digests, although only two are currently supported: MIME digests and RFC 1153 (a.k.a. plain text) digests. >>> from Mailman.Handlers.ToDigest import process - >>> from Mailman.Message import Message >>> from Mailman.queue import Switchboard >>> from Mailman.configuration import config - >>> from Mailman.database import flush - >>> from email import message_from_string >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> mlist.preferred_language = 'en' >>> mlist.web_page_url = 'http://www.example.com/' >>> mlist.real_name = 'XTest' >>> mlist.subject_prefix = '[_XTest] ' >>> mlist.one_last_digest = set() - >>> flush() >>> switchboard = Switchboard(config.VIRGINQUEUE_DIR) This is a helper function used to iterate through all the accumulated digest @@ -45,7 +41,7 @@ update the tests when we switch to a different mailbox format. ... ... Here is message $i ... """).substitute(i=i) - ... yield message_from_string(text, Message) + ... yield message_from_string(text) Short circuiting @@ -59,7 +55,6 @@ storing of posted messages to the mailbox. For example, the mailing list may not allow digests... >>> mlist.digestable = False - >>> flush() >>> msg = makemsg().next() >>> process(mlist, msg, {}) >>> sum(1 for mboxmsg in digest_mbox()) @@ -70,7 +65,6 @@ not allow digests... ...or they may allow digests but the message is already a digest. >>> mlist.digestable = True - >>> flush() >>> process(mlist, msg, dict(isdigest=True)) >>> sum(1 for mboxmsg in digest_mbox()) 0 @@ -87,7 +81,6 @@ triggering the sending of the digest. If none of those criteria are met, then the message will just sit in the mailbox for a while. >>> mlist.digest_size_threshold = 10000 - >>> flush() >>> process(mlist, msg, {}) >>> switchboard.files [] @@ -102,7 +95,6 @@ digest and an RFC 1153 plain text digest. The size threshold is in KB. >>> mlist.digest_size_threshold = 1 >>> mlist.volume = 2 >>> mlist.next_digest_number = 10 - >>> flush() >>> size = 0 >>> for msg in makemsg(): ... process(mlist, msg, {}) @@ -427,7 +419,6 @@ English template will be found and the masthead won't be translated. >>> config.languages.enable_language('fr') >>> config.DEFAULT_SERVER_LANGUAGE = 'fr' >>> mlist.preferred_language = 'fr' - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.org ... To: _xtest@example.com @@ -437,12 +428,11 @@ English template will be found and the masthead won't be translated. ... Content-Transfer-Encoding: 7bit ... ... \x1b$B0lHV\x1b(B - ... """, Message) + ... """) Set the digest threshold to zero so that the digests will be sent immediately. >>> mlist.digest_size_threshold = 0 - >>> flush() >>> process(mlist, msg, {}) >>> sum(1 for mboxmsg in digest_mbox()) 0 diff --git a/Mailman/docs/file-recips.txt b/Mailman/docs/file-recips.txt index eab202eb3..c30dee608 100644 --- a/Mailman/docs/file-recips.txt +++ b/Mailman/docs/file-recips.txt @@ -5,13 +5,9 @@ Mailman can calculate the recipients for a message from a Sendmail-style include file. This file must be called members.txt and it must live in the list's data directory. - >>> from email import message_from_string - >>> from Mailman.Message import Message >>> from Mailman.Handlers.FileRecips import process >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> mlist = config.db.list_manager.create('_xtest@example.com') - >>> flush() Short circuiting @@ -24,7 +20,7 @@ returns. ... From: aperson@example.com ... ... A message. - ... """, Message) + ... """) >>> msgdata = {'recips': 7} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -88,13 +84,12 @@ in the recipients list. ... 'cperson@example.com') >>> address_1.subscribe(mlist, MemberRole.member) <Member: cperson@example.com on _xtest@example.com as MemberRole.member> - >>> flush() >>> msg = message_from_string("""\ ... From: cperson@example.com ... ... A message. - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> sorted(msgdata['recips']) diff --git a/Mailman/docs/filtering.txt b/Mailman/docs/filtering.txt index 5477dd404..49d717cbc 100644 --- a/Mailman/docs/filtering.txt +++ b/Mailman/docs/filtering.txt @@ -7,13 +7,9 @@ message. It does this with the MimeDel handler module, although other handlers can potentially do other kinds of finer level content filtering. >>> from Mailman.Handlers.MimeDel import process - >>> from Mailman.Message import Message >>> from Mailman.configuration import config - >>> from Mailman.database import flush - >>> from email import message_from_string >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> mlist.preferred_language = 'en' - >>> flush() Several mailing list options control content filtering. First, the feature must be enabled, then there are two options that control which MIME types get @@ -25,7 +21,6 @@ for these variables, then we'll explain them in more detail below. >>> mlist.filter_mime_types = [] >>> mlist.pass_mime_types = [] >>> mlist.convert_html_to_plaintext = False - >>> flush() Filtering the outer content type @@ -38,14 +33,13 @@ content type matches the filter, the entire message will be discarded. >>> mlist.filter_mime_types = ['image/jpeg'] >>> # XXX Change this to an enum >>> mlist.filter_action = 0 # Discard - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... Content-Type: image/jpeg ... MIME-Version: 1.0 ... ... xxxxx - ... """, Message) + ... """) >>> process(mlist, msg, {}) Traceback (most recent call last): ... @@ -55,7 +49,6 @@ However, if we turn off content filtering altogether, then the handler short-circuits. >>> mlist.filter_content = False - >>> flush() >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -71,7 +64,6 @@ Similarly, no content filtering is performed on digest messages, which are crafted internally by Mailman. >>> mlist.filter_content = True - >>> flush() >>> msgdata = {'isdigest': True} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -107,7 +99,7 @@ just that subpart will be stripped. ... ... yyy ... --BOUNDARY-- - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> print msg.as_string() From: aperson@example.com @@ -141,7 +133,6 @@ multipart/alternative so that the outer multipart/mixed has just a single gif subpart. >>> mlist.collapse_alternatives = True - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... Content-Type: multipart/mixed; boundary=BOUNDARY @@ -165,7 +156,7 @@ subpart. ... --BOUND2-- ... ... --BOUNDARY-- - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> print msg.as_string() From: aperson@example.com @@ -187,7 +178,6 @@ part's content type. In other words, the left over inner part is promoted to being the outer part. >>> mlist.filter_mime_types.append('text/html') - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... Content-Type: multipart/alternative; boundary=AAA @@ -201,7 +191,7 @@ being the outer part. ... ... This is plain text ... --AAA-- - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> print msg.as_string() From: aperson@example.com @@ -213,7 +203,6 @@ being the outer part. Clean up. >>> ignore = mlist.filter_mime_types.pop() - >>> flush() Conversion to plain text @@ -234,7 +223,6 @@ conversion by defining a conversion command. A list administrator still needs to enable such conversion for their list though. >>> mlist.convert_html_to_plaintext = True - >>> flush() By default, Mailman sends the message through lynx, but since this program is not guaranteed to exist, we'll craft a simple, but stupid script to simulate @@ -261,7 +249,7 @@ name of the file containing the message payload to filter. ... ... <html><head></head> ... <body></body></html> - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> print msg.as_string() From: aperson@example.com @@ -320,7 +308,7 @@ the entire inner multipart/mixed is discarded. ... ... aaa ... --AAA-- - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> print msg.as_string() From: aperson@example.com diff --git a/Mailman/docs/hold.txt b/Mailman/docs/hold.txt index f8934cf6f..9dae760d8 100644 --- a/Mailman/docs/hold.txt +++ b/Mailman/docs/hold.txt @@ -10,14 +10,12 @@ are held when they meet any of a number of criteria. >>> from Mailman.Handlers.Hold import process >>> from Mailman.queue import Switchboard >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> mlist.preferred_language = 'en' >>> mlist.real_name = '_XTest' >>> # XXX This will almost certainly change once we've worked out the web >>> # space layout for mailing lists now. >>> mlist.web_page_url = 'http://lists.example.com/' - >>> flush() Here's a helper function used when we don't care about what's in the virgin queue or in the pending database. @@ -44,12 +42,11 @@ If the message metadata indicates that the message is pre-approved, then the handler returns immediately. >>> from email import message_from_string - >>> from Mailman.Message import Message >>> msg = message_from_string("""\ ... From: aperson@example.com ... ... An important message. - ... """, Message) + ... """) >>> msgdata = {'approved': True} >>> process(mlist, msg, msgdata) >>> print msg.as_string() @@ -70,12 +67,11 @@ like an email command. This is to prevent people sending 'help' or of administrivia for the list. >>> mlist.administrivia = True - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... Subject: unsubscribe ... - ... """, Message) + ... """) >>> process(mlist, msg, {}) Traceback (most recent call last): ... @@ -90,7 +86,6 @@ Mailman will hold messages that have more than a specified number of explicit recipients. >>> mlist.max_num_recipients = 5 - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... To: _xtest@example.com, bperson@example.com @@ -99,7 +94,7 @@ recipients. ... To: Elly Q. Person <eperson@example.com> ... ... Hey folks! - ... """, Message) + ... """) >>> process(mlist, msg, {}) Traceback (most recent call last): ... @@ -115,12 +110,11 @@ mailing list's posting address isn't included in the explicit recipients. >>> mlist.require_explicit_destination = True >>> mlist.acceptable_aliases = '' - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.org ... Subject: An implicit message ... - ... """, Message) + ... """) >>> process(mlist, msg, {}) Traceback (most recent call last): ... @@ -153,13 +147,12 @@ particular regular expression. This mostly historical feature is fairly confusing to users, and the list attribute that controls this is misnamed. >>> mlist.bounce_matching_headers = 'From: .*person@(blah.)?example.com' - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... To: _xtest@example.com ... Subject: An implicit message ... - ... """, Message) + ... """) >>> process(mlist, msg, {}) Traceback (most recent call last): ... @@ -174,7 +167,7 @@ fine. This one comes from a .org address. ... To: _xtest@example.com ... Subject: An implicit message ... - ... """, Message) + ... """) >>> msgdata = {} >>> process(mlist, msg, msgdata) >>> print msgdata @@ -183,7 +176,6 @@ fine. This one comes from a .org address. Just a bit of clean up. >>> mlist.bounce_matching_headers = None - >>> flush() Message size @@ -194,14 +186,13 @@ is used to prevent huge attachments from getting posted to the list. This value is calculated in terms of KB (1024 bytes). >>> mlist.max_message_size = 1 - >>> flush() >>> one_line = 'x' * 79 >>> big_body = '\n'.join([one_line] * 15) >>> msg = message_from_string("""\ ... From: aperson@example.com ... To: _xtest@example.com ... - ... """ + big_body, Message) + ... """ + big_body) >>> process(mlist, msg, {}) Traceback (most recent call last): ... @@ -218,16 +209,14 @@ can show this by first holding a message. >>> mlist.respond_to_post_requests = True >>> mlist.admin_immed_notify = True - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... - ... """, Message) + ... """) >>> process(mlist, msg, {}) Traceback (most recent call last): ... ImplicitDestination - >>> flush() There should be two messages in the virgin queue, one to the list owner and one to the original author. diff --git a/Mailman/docs/lifecycle.txt b/Mailman/docs/lifecycle.txt index 4a6354381..9ac19eb48 100644 --- a/Mailman/docs/lifecycle.txt +++ b/Mailman/docs/lifecycle.txt @@ -64,8 +64,6 @@ Using the higher level interface for creating a list, applies all matching list styles. >>> mlist_1 = create_list('test_1@example.com') - >>> from Mailman.database import flush - >>> flush() >>> mlist_1.fqdn_listname 'test_1@example.com' >>> mlist_1.msg_footer @@ -82,7 +80,6 @@ However the addresses are not verified. >>> owners = ['aperson@example.com', 'bperson@example.com', ... 'cperson@example.com', 'dperson@example.com'] >>> mlist_2 = create_list('test_2@example.com', owners) - >>> flush() >>> mlist_2.fqdn_listname 'test_2@example.com' >>> mlist_2.msg_footer @@ -115,10 +112,8 @@ the system, they won't be created again. >>> user_b.real_name = 'Bart Person' >>> user_c.real_name = 'Caty Person' >>> user_d.real_name = 'Dirk Person' - >>> flush() >>> mlist_3 = create_list('test_3@example.com', owners) - >>> flush() >>> sorted(user.real_name for user in mlist_3.owners.users) ['Anne Person', 'Bart Person', 'Caty Person', 'Dirk Person'] @@ -132,14 +127,12 @@ artifacts. >>> from Mailman import Utils >>> from Mailman.app.lifecycle import remove_list >>> remove_list(mlist_2.fqdn_listname, mlist_2, True) - >>> flush() >>> Utils.list_exists('test_2@example.com') False We should now be able to completely recreate the mailing list. >>> mlist_2a = create_list('test_2@example.com', owners) - >>> flush() >>> sorted(addr.address for addr in mlist_2a.owners.addresses) ['aperson@example.com', 'bperson@example.com', 'cperson@example.com', 'dperson@example.com'] diff --git a/Mailman/docs/listmanager.txt b/Mailman/docs/listmanager.txt index 2c908b169..220be05e6 100644 --- a/Mailman/docs/listmanager.txt +++ b/Mailman/docs/listmanager.txt @@ -6,7 +6,6 @@ objects. The Mailman system instantiates an IListManager for you based on the configuration variable MANAGERS_INIT_FUNCTION. The instance is accessible on the global config object. - >>> from Mailman.database import flush >>> from Mailman.configuration import config >>> from Mailman.interfaces import IListManager >>> listmgr = config.db.list_manager @@ -21,7 +20,6 @@ Creating the list returns the newly created IMailList object. >>> from Mailman.interfaces import IMailingList >>> mlist = listmgr.create('_xtest@example.com') - >>> flush() >>> IMailingList.providedBy(mlist) True @@ -51,14 +49,12 @@ Deleting a mailing list Use the list manager to delete a mailing list. >>> listmgr.delete(mlist) - >>> flush() >>> sorted(listmgr.names) [] After deleting the list, you can create it again. >>> mlist = listmgr.create('_xtest@example.com') - >>> flush() >>> mlist.fqdn_listname '_xtest@example.com' @@ -87,16 +83,7 @@ iterate over either the list objects, or the list names. >>> mlist_3 = listmgr.create('_xtest_3@example.com') >>> mlist_4 = listmgr.create('_xtest_4@example.com') - >>> flush() >>> sorted(listmgr.names) ['_xtest@example.com', '_xtest_3@example.com', '_xtest_4@example.com'] >>> sorted(m.fqdn_listname for m in listmgr.mailing_lists) ['_xtest@example.com', '_xtest_3@example.com', '_xtest_4@example.com'] - - -Cleaning up ------------ - - >>> for mlist in listmgr.mailing_lists: - ... listmgr.delete(mlist) - >>> flush() diff --git a/Mailman/docs/membership.txt b/Mailman/docs/membership.txt index 414012bc3..01c86ac3f 100644 --- a/Mailman/docs/membership.txt +++ b/Mailman/docs/membership.txt @@ -15,9 +15,7 @@ store mailing list data in a different database than user data. When we create a mailing list, it starts out with no members... >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> mlist = config.db.list_manager.create('_xtest@example.com') - >>> flush() >>> mlist <mailing list "_xtest@example.com" at ...> >>> sorted(member.address.address for member in mlist.members.members) @@ -67,7 +65,6 @@ no users in the user database yet. >>> usermgr = config.db.user_manager >>> user_1 = usermgr.create_user('aperson@example.com', 'Anne Person') - >>> flush() >>> user_1.real_name 'Anne Person' >>> sorted(address.address for address in user_1.addresses) @@ -83,7 +80,6 @@ her. >>> address_1.subscribe(mlist, MemberRole.owner) <Member: Anne Person <aperson@example.com> on _xtest@example.com as MemberRole.owner> - >>> flush() >>> sorted(member.address.address for member in mlist.owners.members) ['aperson@example.com'] >>> sorted(user.real_name for user in mlist.owners.users) @@ -105,7 +101,6 @@ We can add Ben as a moderator of the list, by creating a different member role for him. >>> user_2 = usermgr.create_user('bperson@example.com', 'Ben Person') - >>> flush() >>> user_2.real_name 'Ben Person' >>> address_2 = list(user_2.addresses)[0] @@ -114,7 +109,6 @@ for him. >>> address_2.subscribe(mlist, MemberRole.moderator) <Member: Ben Person <bperson@example.com> on _xtest@example.com as MemberRole.moderator> - >>> flush() >>> sorted(member.address.address for member in mlist.moderators.members) ['bperson@example.com'] >>> sorted(user.real_name for user in mlist.moderators.users) @@ -144,7 +138,6 @@ preference, then the user's preference, then the list's preference. Start without any member preference to see the system defaults. >>> user_3 = usermgr.create_user('cperson@example.com', 'Claire Person') - >>> flush() >>> user_3.real_name 'Claire Person' >>> address_3 = list(user_3.addresses)[0] @@ -153,7 +146,6 @@ without any member preference to see the system defaults. >>> address_3.subscribe(mlist, MemberRole.member) <Member: Claire Person <cperson@example.com> on _xtest@example.com as MemberRole.member> - >>> flush() Claire will be a regular delivery member but not a digest member. @@ -175,7 +167,6 @@ It's easy to make the list administrators members of the mailing list too. _xtest@example.com as MemberRole.member>, <Member: Ben Person <bperson@example.com> on _xtest@example.com as MemberRole.member>] - >>> flush() >>> sorted(address.address for address in mlist.members.addresses) ['aperson@example.com', 'bperson@example.com', 'cperson@example.com'] >>> sorted(address.address for address in mlist.regular_members.addresses) diff --git a/Mailman/docs/message.txt b/Mailman/docs/message.txt index 601b871bf..4f0d08ce2 100644 --- a/Mailman/docs/message.txt +++ b/Mailman/docs/message.txt @@ -13,10 +13,8 @@ instance, and then calls the .send() method on this object. This method requires a mailing list instance. >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> mlist.preferred_language = u'en' - >>> flush() The UserNotification constructor takes the recipient address, the sender address, an optional subject, optional body text, and optional language. diff --git a/Mailman/docs/messagestore.txt b/Mailman/docs/messagestore.txt index a1ed09cb2..516ef257b 100644 --- a/Mailman/docs/messagestore.txt +++ b/Mailman/docs/messagestore.txt @@ -10,9 +10,7 @@ second piece of information is supplied by the message store; it is a sequence number that will uniquely identify the message even when the X-List-ID-Hash collides. - >>> from email import message_from_string >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> store = config.db.message_store If you try to add a message to the store which is missing the Message-ID @@ -33,7 +31,6 @@ However, if the message has a Message-ID header, it can be stored. >>> msg['Message-ID'] = '<87myycy5eh.fsf@uwakimon.sk.tsukuba.ac.jp>' >>> store.add(msg) 1 - >>> flush() >>> print msg.as_string() Subject: An important message Message-ID: <87myycy5eh.fsf@uwakimon.sk.tsukuba.ac.jp> @@ -138,7 +135,6 @@ delete a global ID that isn't in the store, you get an exception. But if you delete an existing message, it really gets deleted. >>> store.delete_message(global_id) - >>> flush() >>> list(store.messages) [] >>> print store.get_message(global_id) diff --git a/Mailman/docs/news-runner.txt b/Mailman/docs/news-runner.txt index 834423c6e..7adbc7add 100644 --- a/Mailman/docs/news-runner.txt +++ b/Mailman/docs/news-runner.txt @@ -6,14 +6,10 @@ NNTP newsgroup. One of the most important things this runner does is prepare the message for Usenet (yes, I know that NNTP is not Usenet, but this runner was originally written to gate to Usenet, which has its own rules). - >>> from email import message_from_string - >>> from Mailman.Message import Message >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> from Mailman.queue.news import prepare_message >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> mlist.linked_newsgroup = 'comp.lang.python' - >>> flush() Some NNTP servers such as INN reject messages containing a set of prohibited headers, so one of the things that the news runner does is remove these @@ -35,7 +31,7 @@ prohibited headers. ... Received: blah blah ... ... A message - ... """, Message) + ... """) >>> msgdata = {} >>> prepare_message(mlist, msg, msgdata) >>> msgdata['prepped'] @@ -66,7 +62,7 @@ X-Original-* header that the news server doesn't care about. ... Content-Transfer-Encoding: maybe ... ... A message - ... """, Message) + ... """) >>> msgdata = {} >>> prepare_message(mlist, msg, msgdata) >>> msgdata['prepped'] @@ -98,7 +94,7 @@ the message. ... Content-Transfer-Encoding: yes ... ... A message - ... """, Message) + ... """) >>> msgdata = {} >>> prepare_message(mlist, msg, msgdata) >>> msgdata['prepped'] @@ -124,7 +120,6 @@ address is added for the benefit of the Usenet system. >>> from Mailman.interfaces import NewsModeration >>> mlist.news_moderation = NewsModeration.open_moderated - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... To: _xtest@example.com @@ -136,7 +131,6 @@ address is added for the benefit of the Usenet system. '_xtest@example.com' >>> mlist.news_moderation = NewsModeration.moderated - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... To: _xtest@example.com @@ -150,7 +144,6 @@ address is added for the benefit of the Usenet system. But if the newsgroup is not moderated, the Approved: header is not chnaged. >>> mlist.news_moderation = NewsModeration.none - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... To: _xtest@example.com diff --git a/Mailman/docs/nntp.txt b/Mailman/docs/nntp.txt index 9748a06ca..f8b837388 100644 --- a/Mailman/docs/nntp.txt +++ b/Mailman/docs/nntp.txt @@ -6,14 +6,10 @@ be forwarded onto an NNTP newsgroup. Typically this means Usenet, but since NNTP is to Usenet as IP is to the web, it's more general than that. >>> from Mailman.Handlers.ToUsenet import process - >>> from Mailman.Message import Message >>> from Mailman.queue import Switchboard >>> from Mailman.configuration import config - >>> from Mailman.database import flush - >>> from email import message_from_string >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> mlist.preferred_language = 'en' - >>> flush() >>> switchboard = Switchboard(config.NEWSQUEUE_DIR) Gatewaying from the mailing list to the newsgroup happens through a separate @@ -25,12 +21,11 @@ There are several situations which prevent a message from being gatewayed to the newsgroup. The feature could be disabled, as is the default. >>> mlist.gateway_to_news = False - >>> flush() >>> msg = message_from_string("""\ ... Subject: An important message ... ... Something of great import. - ... """, Message) + ... """) >>> process(mlist, msg, {}) >>> switchboard.files [] @@ -39,7 +34,6 @@ Even if enabled, messages that came from the newsgroup are never gated back to the newsgroup. >>> mlist.gateway_to_news = True - >>> flush() >>> process(mlist, msg, {'fromusenet': True}) >>> switchboard.files [] @@ -56,7 +50,6 @@ messages are gated to. >>> mlist.linked_newsgroup = 'comp.lang.thing' >>> mlist.nntp_host = 'news.example.com' - >>> flush() >>> process(mlist, msg, {}) >>> len(switchboard.files) 1 diff --git a/Mailman/docs/outgoing.txt b/Mailman/docs/outgoing.txt index 05dac1fe4..48bc287b8 100644 --- a/Mailman/docs/outgoing.txt +++ b/Mailman/docs/outgoing.txt @@ -10,13 +10,9 @@ basically describes how to encode the recipient's address in the originator headers for unambigous bounce processing. >>> from Mailman.Handlers.ToOutgoing import process - >>> from Mailman.Message import Message >>> from Mailman.queue import Switchboard >>> from Mailman.configuration import config - >>> from Mailman.database import flush - >>> from email import message_from_string >>> mlist = config.db.list_manager.create('_xtest@example.com') - >>> flush() >>> switchboard = Switchboard(config.OUTQUEUE_DIR) >>> def queue_size(): @@ -33,7 +29,7 @@ as if this message had passed through some other handlers. ... Subject: Here is a message ... ... Something of great import. - ... """, Message) + ... """) When certain conditions are met, the message will be VERP'd. For example, if the message metadata already has a VERP key, this message will be VERP'd. @@ -72,7 +68,6 @@ VERP'd. >>> from Mailman.interfaces import Personalization >>> mlist.personalize = Personalization.individual - >>> flush() >>> config.VERP_PERSONALIZED_DELIVERIES = True >>> msgdata = dict(foo=1, bar=2) >>> process(mlist, msg, msgdata) @@ -98,7 +93,6 @@ Mailman how often to VERP even non-personalized mailing lists. It can be set to zero, which means non-personalized messages will never be VERP'd. >>> mlist.personalize = Personalization.none - >>> flush() >>> config.VERP_DELIVERY_INTERVAL = 0 >>> msgdata = dict(foo=1, bar=2) >>> process(mlist, msg, msgdata) @@ -133,7 +127,6 @@ will be VERP'd. >>> config.VERP_DELIVERY_INTERVAL = 3 >>> for i in range(10): ... mlist.post_id = i - ... flush() ... msgdata = dict(foo=1, bar=2) ... process(mlist, msg, msgdata) ... print i, msgdata.get('verp', False) diff --git a/Mailman/docs/pending.txt b/Mailman/docs/pending.txt index d93da5283..be0050c0c 100644 --- a/Mailman/docs/pending.txt +++ b/Mailman/docs/pending.txt @@ -7,7 +7,6 @@ messages (but only for user confirmation), auto-approvals, and probe bounces. This is not where messages held for administrator approval are kept. >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> from zope.interface import implements >>> from zope.interface.verify import verifyObject @@ -32,7 +31,6 @@ that can be used in urls and such. ... language='en', ... password='xyz') >>> token = pendingdb.add(subscription) - >>> flush() >>> len(token) 40 @@ -45,7 +43,6 @@ returned. >>> print pendable None >>> pendable = pendingdb.confirm(token) - >>> flush() >>> sorted(pendable.items()) [('address', 'aperson@example.com'), ('language', 'en'), @@ -69,17 +66,13 @@ expunge it. >>> token_2 = pendingdb.add(event_2) >>> event_3 = SimplePendable(type='three') >>> token_3 = pendingdb.add(event_3) - >>> flush() >>> pendable = pendingdb.confirm(token_1, expunge=False) - >>> flush() >>> pendable.items() [('type', 'one')] >>> pendable = pendingdb.confirm(token_1, expunge=True) - >>> flush() >>> pendable.items() [('type', 'one')] >>> pendable = pendingdb.confirm(token_1) - >>> flush() >>> print pendable None @@ -90,16 +83,13 @@ default lifetime. >>> yesterday = timedelta(days=-1) >>> event_4 = SimplePendable(type='four') >>> token_4 = pendingdb.add(event_4, lifetime=yesterday) - >>> flush() Every once in a while the pending database is cleared of old records. >>> pendingdb.evict() - >>> flush() >>> pendable = pendingdb.confirm(token_4) >>> print pendable None >>> pendable = pendingdb.confirm(token_2) >>> pendable.items() [('type', 'two')] - >>> flush() diff --git a/Mailman/docs/registration.txt b/Mailman/docs/registration.txt index 219a0cef5..ef2b622e5 100644 --- a/Mailman/docs/registration.txt +++ b/Mailman/docs/registration.txt @@ -9,7 +9,6 @@ will send them any list traffic. >>> from Mailman.app.registrar import Registrar >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> from Mailman.interfaces import IRegistrar The IUserManager manages users, but it does so at a fairly low level. @@ -106,7 +105,6 @@ record is added to the pending database, and the token for that record is returned. >>> token = registrar.register('aperson@example.com', 'Anne Person') - >>> flush() >>> check_token(token) ok @@ -204,7 +202,6 @@ extracts the token and uses that to confirm the pending registration. >>> registrar.confirm(token) True - >>> flush() Now, there is an IAddress in the database matching the address, as well as an IUser linked to this address. The IAddress is verified. @@ -229,7 +226,6 @@ If you try to confirm a registration token twice, of course only the first one will work. The second one is ignored. >>> token = registrar.register('bperson@example.com') - >>> flush() >>> check_token(token) ok >>> filebase = switchboard.files[0] @@ -240,7 +236,6 @@ will work. The second one is ignored. True >>> registrar.confirm(token) True - >>> flush() >>> registrar.confirm(token) False @@ -250,9 +245,7 @@ confirmation step is completed. >>> usermgr.create_address('cperson@example.com') <Address: cperson@example.com [not verified] at ...> - >>> flush() >>> token = registrar.register('cperson@example.com', 'Claire Person') - >>> flush() >>> print usermgr.get_user('cperson@example.com') None >>> filebase = switchboard.files[0] @@ -260,7 +253,6 @@ confirmation step is completed. >>> switchboard.finish(filebase) >>> registrar.confirm(token) True - >>> flush() >>> usermgr.get_user('cperson@example.com') <User "Claire Person" at ...> >>> usermgr.get_address('cperson@example.com') @@ -279,12 +271,10 @@ created now and they are linked, with no confirmation necessary. >>> address = usermgr.create_address('dperson@example.com', 'Dave Person') >>> address.verified_on = datetime.now() - >>> flush() >>> print usermgr.get_user('dperson@example.com') None >>> print registrar.register('dperson@example.com') None - >>> flush() >>> len(switchboard.files) 0 >>> usermgr.get_user('dperson@example.com') @@ -300,9 +290,7 @@ mind about registering. When discarded, no IAddress or IUser is created. >>> token = registrar.register('eperson@example.com', 'Elly Person') >>> check_token(token) ok - >>> flush() >>> registrar.discard(token) - >>> flush() >>> print pendingdb.confirm(token) None >>> print usermgr.get_address('eperson@example.com') @@ -326,9 +314,7 @@ can be used. [<Address: Dave Person <dperson@example.com> [verified] at ...>] >>> dperson.register('david.person@example.com', 'David Person') <Address: David Person <david.person@example.com> [not verified] at ...> - >>> flush() >>> token = registrar.register('david.person@example.com') - >>> flush() >>> filebase = switchboard.files[0] >>> qmsg, qdata = switchboard.dequeue(filebase) >>> switchboard.finish(filebase) @@ -362,10 +348,8 @@ pending even matched with that token will still be removed. ... implements(IPendable) >>> pendable = SimplePendable(type='foo', bar='baz') >>> token = pendingdb.add(pendable) - >>> flush() >>> registrar.confirm(token) False - >>> flush() >>> print pendingdb.confirm(token) None @@ -374,9 +358,7 @@ record, you will also get None back, and the record will be removed. >>> pendable = SimplePendable(type='registration', foo='bar') >>> token = pendingdb.add(pendable) - >>> flush() >>> registrar.confirm(token) False - >>> flush() >>> print pendingdb.confirm(token) None diff --git a/Mailman/docs/reply-to.txt b/Mailman/docs/reply-to.txt index a937ced8f..51fd5a143 100644 --- a/Mailman/docs/reply-to.txt +++ b/Mailman/docs/reply-to.txt @@ -7,14 +7,10 @@ transformations. Some headers get added, others get changed. Some of these changes depend on mailing list settings and others depend on how the message is getting sent through the system. We'll take things one-by-one. - >>> from email import message_from_string - >>> from Mailman.Message import Message >>> from Mailman.Handlers.CookHeaders import process >>> from Mailman.configuration import config - >>> from Mailman.database import flush >>> mlist = config.db.list_manager.create('_xtest@example.com') >>> mlist.subject_prefix = u'' - >>> flush() Reply-to munging refers to the behavior where a mailing list can be configured to change or augment an existing Reply-To header in a message posted to the @@ -45,7 +41,6 @@ message, the list's posting address simply gets inserted. >>> mlist.reply_goes_to_list = ReplyToMunging.point_to_list >>> mlist.preferred_language = 'en' >>> mlist.description = '' - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... @@ -60,7 +55,6 @@ It's also possible to strip any existing Reply-To header first, before adding the list's posting address. >>> mlist.first_strip_reply_to = True - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... Reply-To: bperson@example.com @@ -76,7 +70,6 @@ If you don't first strip the header, then the list's posting address will just get appended to whatever the original version was. >>> mlist.first_strip_reply_to = False - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... Reply-To: bperson@example.com @@ -96,7 +89,6 @@ The list can also be configured to have an explicit Reply-To header. >>> mlist.reply_goes_to_list = ReplyToMunging.explicit_header >>> mlist.reply_to_address = 'my-list@example.com' - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... @@ -110,7 +102,6 @@ The list can also be configured to have an explicit Reply-To header. And as before, it's possible to either strip any existing Reply-To header... >>> mlist.first_strip_reply_to = True - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... Reply-To: bperson@example.com @@ -125,7 +116,6 @@ And as before, it's possible to either strip any existing Reply-To header... ...or not. >>> mlist.first_strip_reply_to = False - >>> flush() >>> msg = message_from_string("""\ ... From: aperson@example.com ... Reply-To: bperson@example.com |
