"Fossies" - the Fresh Open Source Software Archive

Member "mailman-3.3.7/src/mailman/handlers/docs/after-delivery.rst" (10 Nov 2022, 1105 Bytes) of package /linux/misc/mailman-3.3.7.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

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.

>>> from datetime import timedelta >>> from mailman.utilities.datetime import now >>> from mailman.app.lifecycle import create_list >>> mlist = create_list('_xtest@example.com') >>> post_time = now() - timedelta(minutes=10) >>> mlist.last_post_at = post_time >>> mlist.post_id = 10

Processing a message with this handler updates the last_post_at and post_id attributes. :

>>> from mailman.testing.helpers import (specialized_message_from_string
...   as message_from_string)
>>> msg = message_from_string("""\
... From: aperson@example.com
...
... Something interesting.
... """)

>>> from mailman.config import config    
>>> handler = config.handlers['after-delivery']
>>> handler.process(mlist, msg, {})
>>> mlist.last_post_at > post_time
True
>>> mlist.post_id
11