summaryrefslogtreecommitdiff
path: root/Mailman/docs
diff options
context:
space:
mode:
authorBarry Warsaw2007-06-18 14:53:34 -0400
committerBarry Warsaw2007-06-18 14:53:34 -0400
commitc7d4e4c593d3bb1356fc099581d6f3e3deb0c1d4 (patch)
tree9710629c44708561ada1849fcce2281cc849f81d /Mailman/docs
parent511a33778c4195c4abca7c58aa6917e6a77059b6 (diff)
downloadmailman-c7d4e4c593d3bb1356fc099581d6f3e3deb0c1d4.tar.gz
mailman-c7d4e4c593d3bb1356fc099581d6f3e3deb0c1d4.tar.zst
mailman-c7d4e4c593d3bb1356fc099581d6f3e3deb0c1d4.zip
Convert the AfterDelivery handler test to a doctest. Also, change the
MailingList.last_post_time column to a DateTime (i.e. Python datetime object).
Diffstat (limited to 'Mailman/docs')
-rw-r--r--Mailman/docs/acknowledge.txt10
-rw-r--r--Mailman/docs/after-delivery.txt43
2 files changed, 53 insertions, 0 deletions
diff --git a/Mailman/docs/acknowledge.txt b/Mailman/docs/acknowledge.txt
index 6c7e3c28f..6f47fd64d 100644
--- a/Mailman/docs/acknowledge.txt
+++ b/Mailman/docs/acknowledge.txt
@@ -174,3 +174,13 @@ If there is no subject, then the receipt will use a generic message.
List info page: http://lists.example.com/listinfo/_xtest@example.com
Your preferences: http://example.com/aperson@example.com
<BLANKLINE>
+
+
+Clean up
+--------
+
+ >>> for mlist in config.list_manager.mailing_lists:
+ ... config.list_manager.delete(mlist)
+ >>> flush()
+ >>> list(config.list_manager.mailing_lists)
+ []
diff --git a/Mailman/docs/after-delivery.txt b/Mailman/docs/after-delivery.txt
new file mode 100644
index 000000000..ac2472745
--- /dev/null
+++ b/Mailman/docs/after-delivery.txt
@@ -0,0 +1,43 @@
+After delivery
+==============
+
+After a message is delivered, or more correctly, after it has been processed
+by the rest of the handlers in the incoming queue pipeline, a couple of
+bookkeeping pieces of information are updated.
+
+ >>> import datetime
+ >>> from email import message_from_string
+ >>> from Mailman.Message import Message
+ >>> from Mailman.Handlers.AfterDelivery import process
+ >>> from Mailman.configuration import config
+ >>> from Mailman.database import flush
+ >>> mlist = config.list_manager.create('_xtest@example.com')
+ >>> post_time = datetime.datetime.now() - datetime.timedelta(minutes=10)
+ >>> mlist.last_post_time = post_time
+ >>> mlist.post_id = 10
+ >>> flush()
+
+Processing a message with this handler updates the last_post_time and post_id
+attributes.
+
+ >>> msg = message_from_string("""\
+ ... From: aperson@example.com
+ ...
+ ... Something interesting.
+ ... """, Message)
+ >>> process(mlist, msg, {})
+ >>> flush()
+ >>> mlist.last_post_time > post_time
+ True
+ >>> mlist.post_id
+ 11
+
+
+Clean up
+--------
+
+ >>> for mlist in config.list_manager.mailing_lists:
+ ... config.list_manager.delete(mlist)
+ >>> flush()
+ >>> list(config.list_manager.mailing_lists)
+ []