summaryrefslogtreecommitdiff
path: root/src/mailman/pipeline/docs/replybot.txt
diff options
context:
space:
mode:
authorBarry Warsaw2009-02-19 20:46:57 -0500
committerBarry Warsaw2009-02-19 20:46:57 -0500
commitfcec8479c1f07576094102128408f4c23b278bb5 (patch)
tree9806fcc832a4aff842c64f8b1c8ee51d482a66b0 /src/mailman/pipeline/docs/replybot.txt
parentcf68d5d364a4453c3ab4a22ca04046d7a0d4cc1d (diff)
downloadmailman-fcec8479c1f07576094102128408f4c23b278bb5.tar.gz
mailman-fcec8479c1f07576094102128408f4c23b278bb5.tar.zst
mailman-fcec8479c1f07576094102128408f4c23b278bb5.zip
Complete the porting of the autoresponse implementation, with no need of the
old pickle attributes. Fix a typo in the datetime.py module.
Diffstat (limited to 'src/mailman/pipeline/docs/replybot.txt')
-rw-r--r--src/mailman/pipeline/docs/replybot.txt226
1 files changed, 173 insertions, 53 deletions
diff --git a/src/mailman/pipeline/docs/replybot.txt b/src/mailman/pipeline/docs/replybot.txt
index 3de6679dd..696570401 100644
--- a/src/mailman/pipeline/docs/replybot.txt
+++ b/src/mailman/pipeline/docs/replybot.txt
@@ -2,9 +2,9 @@ Auto-reply handler
==================
Mailman has an auto-reply handler that sends automatic responses to messages
-it receives on its posting address, or special robot addresses. Automatic
-responses are subject to various conditions, such as headers in the original
-message or the amount of time since the last auto-response.
+it receives on its posting address, owner address, or robot address.
+Automatic responses are subject to various conditions, such as headers in the
+original message or the amount of time since the last auto-response.
>>> mlist = create_list(u'_xtest@example.com')
>>> mlist.real_name = u'XTest'
@@ -16,19 +16,20 @@ message or the amount of time since the last auto-response.
[]
-Basic autoresponding
---------------------
+Basic automatic responding
+--------------------------
-Basic autoresponding occurs when the list is set up to respond to either its
--owner address, its -request address, or to the posting address, and a message
-is sent to one of these addresses. A mailing list also has an autoresponse
-grace period which describes how much time must pass before a second response
-will be sent, with 0 meaning "there is no grace period".
+Basic automatic responding occurs when the list is set up to respond to either
+its -owner address, its -request address, or to the posting address, and a
+message is sent to one of these addresses. A mailing list also has an
+automatic response grace period which specifies how much time must pass before
+a second response will be sent, with 0 meaning "there is no grace period".
>>> import datetime
>>> mlist.autorespond_admin = True
>>> mlist.autoresponse_graceperiod = datetime.timedelta()
>>> mlist.autoresponse_admin_text = u'admin autoresponse text'
+
>>> msg = message_from_string("""\
... From: aperson@example.com
... To: _xtest-owner@example.com
@@ -36,20 +37,25 @@ will be sent, with 0 meaning "there is no grace period".
... help
... """)
+The preceding message to the mailing list's owner will trigger an automatic
+response.
+
>>> from mailman.pipeline.replybot import process
+ >>> from mailman.testing.helpers import get_queue_messages
>>> process(mlist, msg, dict(toowner=True))
- >>> len(virginq.files)
+ >>> messages = get_queue_messages('virgin')
+ >>> len(messages)
1
- >>> qmsg, qdata = virginq.dequeue(virginq.files[0])
- >>> # Print only some of the meta data. The rest is uninteresting.
- >>> qdata['listname']
- u'_xtest@example.com'
- >>> sorted(qdata['recips'])
- [u'aperson@example.com']
- >>> # Delete data that is time dependent or random
- >>> del qmsg['message-id']
- >>> del qmsg['date']
- >>> print qmsg.as_string()
+
+ >>> dump_msgdata(messages[0].msgdata)
+ _parsemsg : False
+ listname : _xtest@example.com
+ nodecorate : True
+ recips : [u'aperson@example.com']
+ reduced_list_headers: True
+ version : 3
+
+ >>> print messages[0].msg.as_string()
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
@@ -58,19 +64,19 @@ will be sent, with 0 meaning "there is no grace period".
To: aperson@example.com
X-Mailer: The Mailman Replybot
X-Ack: No
+ Message-ID: <...>
+ Date: ...
Precedence: bulk
<BLANKLINE>
admin autoresponse text
- >>> virginq.files
- []
Short circuiting
----------------
-Several headers in the original message determine whether an autoresponse
-should even be sent. For example, if the message has an "X-Ack: No" header,
-no auto-response is sent.
+Several headers in the original message determine whether an automatic
+response should even be sent. For example, if the message has an "X-Ack: No"
+header, no auto-response is sent.
>>> msg = message_from_string("""\
... From: aperson@example.com
@@ -78,24 +84,26 @@ no auto-response is sent.
...
... help me
... """)
+
>>> process(mlist, msg, dict(toowner=True))
- >>> virginq.files
+ >>> get_queue_messages('virgin')
[]
-Mailman itself can suppress autoresponses for certain types of internally
-crafted messages, by setting the 'noack' metadata key.
+Mailman itself can suppress automatic responses for certain types of
+internally crafted messages, by setting the 'noack' metadata key.
>>> msg = message_from_string("""\
... From: mailman@example.com
...
... help for you
... """)
+
>>> process(mlist, msg, dict(noack=True, toowner=True))
- >>> virginq.files
+ >>> get_queue_messages('virgin')
[]
If there is a Precedence: header with any of the values 'bulk', 'junk', or
-'list', then the autoresponse is also suppressed.
+'list', then the automatic response is also suppressed.
>>> msg = message_from_string("""\
... From: asystem@example.com
@@ -103,17 +111,19 @@ If there is a Precedence: header with any of the values 'bulk', 'junk', or
...
... hey!
... """)
+
>>> process(mlist, msg, dict(toowner=True))
- >>> virginq.files
+ >>> get_queue_messages('virgin')
[]
>>> msg.replace_header('precedence', 'junk')
>>> process(mlist, msg, dict(toowner=True))
- >>> virginq.files
+ >>> get_queue_messages('virgin')
[]
+
>>> msg.replace_header('precedence', 'list')
>>> process(mlist, msg, dict(toowner=True))
- >>> virginq.files
+ >>> get_queue_messages('virgin')
[]
Unless the X-Ack: header has a value of "yes", in which case, the Precedence
@@ -121,12 +131,19 @@ header is ignored.
>>> msg['X-Ack'] = 'yes'
>>> process(mlist, msg, dict(toowner=True))
- >>> len(virginq.files)
+ >>> messages = get_queue_messages('virgin')
+ >>> len(messages)
1
- >>> qmsg, qdata = virginq.dequeue(virginq.files[0])
- >>> del qmsg['message-id']
- >>> del qmsg['date']
- >>> print qmsg.as_string()
+
+ >>> dump_msgdata(messages[0].msgdata)
+ _parsemsg : False
+ listname : _xtest@example.com
+ nodecorate : True
+ recips : [u'asystem@example.com']
+ reduced_list_headers: True
+ version : 3
+
+ >>> print messages[0].msg.as_string()
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
@@ -135,6 +152,8 @@ header is ignored.
To: asystem@example.com
X-Mailer: The Mailman Replybot
X-Ack: No
+ Message-ID: <...>
+ Date: ...
Precedence: bulk
<BLANKLINE>
admin autoresponse text
@@ -149,19 +168,20 @@ auto-responses: those sent to the -request address...
>>> mlist.autorespond_requests = True
>>> mlist.autoresponse_request_text = u'robot autoresponse text'
+
>>> msg = message_from_string("""\
... From: aperson@example.com
... To: _xtest-request@example.com
...
... help me
... """)
+
>>> process(mlist, msg, dict(torequest=True))
- >>> len(virginq.files)
+ >>> messages = get_queue_messages('virgin')
+ >>> len(messages)
1
- >>> qmsg, qdata = virginq.dequeue(virginq.files[0])
- >>> del qmsg['message-id']
- >>> del qmsg['date']
- >>> print qmsg.as_string()
+
+ >>> print messages[0].msg.as_string()
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
@@ -170,6 +190,8 @@ auto-responses: those sent to the -request address...
To: aperson@example.com
X-Mailer: The Mailman Replybot
X-Ack: No
+ Message-ID: <...>
+ Date: ...
Precedence: bulk
<BLANKLINE>
robot autoresponse text
@@ -178,19 +200,20 @@ auto-responses: those sent to the -request address...
>>> mlist.autorespond_postings = True
>>> mlist.autoresponse_postings_text = u'postings autoresponse text'
+
>>> msg = message_from_string("""\
... From: aperson@example.com
... To: _xtest@example.com
...
... help me
... """)
+
>>> process(mlist, msg, {})
- >>> len(virginq.files)
+ >>> messages = get_queue_messages('virgin')
+ >>> len(messages)
1
- >>> qmsg, qdata = virginq.dequeue(virginq.files[0])
- >>> del qmsg['message-id']
- >>> del qmsg['date']
- >>> print qmsg.as_string()
+
+ >>> print messages[0].msg.as_string()
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
@@ -199,6 +222,8 @@ auto-responses: those sent to the -request address...
To: aperson@example.com
X-Mailer: The Mailman Replybot
X-Ack: No
+ Message-ID: <...>
+ Date: ...
Precedence: bulk
<BLANKLINE>
postings autoresponse text
@@ -207,8 +232,103 @@ auto-responses: those sent to the -request address...
Grace periods
-------------
-Auto-responses have a grace period, during which no additional responses will
-be sent. This is so as not to bombard the sender with responses. The grace
-period is measured in days.
+Automatic responses have a grace period, during which no additional responses
+will be sent. This is so as not to bombard the sender with responses. The
+grace period is measured in days.
+
+ >>> mlist.autoresponse_graceperiod = datetime.timedelta(days=10)
+
+When a response is sent to a person via any of the owner, request, or postings
+addresses, the response date is recorded. The grace period is usually
+measured in days.
+
+ >>> msg = message_from_string("""\
+ ... From: bperson@example.com
+ ... To: _xtest-owner@example.com
+ ...
+ ... help
+ ... """)
+
+This is the first response to bperson, so it gets sent.
+
+ >>> process(mlist, msg, dict(toowner=True))
+ >>> print len(get_queue_messages('virgin'))
+ 1
+
+But with a grace period greater than zero, no subsequent response will be sent
+right now.
+
+ >>> process(mlist, msg, dict(toowner=True))
+ >>> print len(get_queue_messages('virgin'))
+ 0
+
+Fast forward 9 days and you still don't get a response.
+
+ >>> from mailman.utilities.datetime import factory
+ >>> factory.fast_forward(days=9)
-XXX Add grace period tests.
+ >>> process(mlist, msg, dict(toowner=True))
+ >>> print len(get_queue_messages('virgin'))
+ 0
+
+But tomorrow, the sender will get a new auto-response.
+
+ >>> factory.fast_forward()
+ >>> process(mlist, msg, dict(toowner=True))
+ >>> print len(get_queue_messages('virgin'))
+ 1
+
+Of course, everything works the same way for messages to the request
+address, even if the sender is the same person...
+
+ >>> msg = message_from_string("""\
+ ... From: bperson@example.com
+ ... To: _xtest-request@example.com
+ ...
+ ... help
+ ... """)
+
+ >>> process(mlist, msg, dict(torequest=True))
+ >>> print len(get_queue_messages('virgin'))
+ 1
+
+ >>> process(mlist, msg, dict(torequest=True))
+ >>> print len(get_queue_messages('virgin'))
+ 0
+
+ >>> factory.fast_forward(days=9)
+ >>> process(mlist, msg, dict(torequest=True))
+ >>> print len(get_queue_messages('virgin'))
+ 0
+
+ >>> factory.fast_forward()
+ >>> process(mlist, msg, dict(torequest=True))
+ >>> print len(get_queue_messages('virgin'))
+ 1
+
+...and for messages to the posting address.
+
+ >>> msg = message_from_string("""\
+ ... From: bperson@example.com
+ ... To: _xtest@example.com
+ ...
+ ... help
+ ... """)
+
+ >>> process(mlist, msg, {})
+ >>> print len(get_queue_messages('virgin'))
+ 1
+
+ >>> process(mlist, msg, {})
+ >>> print len(get_queue_messages('virgin'))
+ 0
+
+ >>> factory.fast_forward(days=9)
+ >>> process(mlist, msg, {})
+ >>> print len(get_queue_messages('virgin'))
+ 0
+
+ >>> factory.fast_forward()
+ >>> process(mlist, msg, {})
+ >>> print len(get_queue_messages('virgin'))
+ 1