From 35b32dc925609ef76e83a13e18b6f9460f0fee4f Mon Sep 17 00:00:00 2001 From: Max Erenberg Date: Sat, 10 Apr 2021 01:57:39 -0400 Subject: [PATCH] update README --- README.md | 29 +++++++++++-------- setup.cfg | 2 +- .../monthly_archiver.py | 2 +- src/extra_mailman_archivers/pipermail.py | 7 ++++- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index a29c300..3701e1f 100644 --- a/README.md +++ b/README.md @@ -15,24 +15,29 @@ pip3 install . ``` ## MonthlyArchiver -MonthlyArchiver simply gzips -each message and stores it in a folder named by the year and month. Each -message's file name is a Unix epoch timestamp. +This archiver stores each message in a maildir folder for the message's year +and month. The motivation behind `MonthlyArchiver` was to avoid storing thousands of messages in a single directory, which the `Prototype` archiver currently -does since it uses a maildir. +does. Example directory structure: ``` -/var/lib/mailman3/archives -\_ monthly_archiver - \_ mylist@mydomain.com - \_ 2021-April - \_ 1617678398.173.mail.gz - \_ 1617678805.351.mail.gz - \_ 2021-May - \_ ... +/var/lib/mailman3/archives/ +|-- monthly_archiver/ + |-- mylist@mydomain.com/ + |-- 2021/ + |-- April/ + | |-- cur/ + | |-- new/ + | | |-- 1618032020.M509265P87123Q1.mail + | | |-- 1618032509.M464173P87208Q1.mail + | |-- tmp/ + |-- May/ + |-- cur/ + |-- new/ + |-- tmp/ ``` To enable this archiver, add the following to your mailman.cfg: diff --git a/setup.cfg b/setup.cfg index 5f9df96..3db15f6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = extra-mailman-archivers -version = 0.0.2 +version = 0.0.3 author = Max Erenberg author_email = merenber@csclub.uwaterloo.ca description = Some extra archivers for Mailman 3 diff --git a/src/extra_mailman_archivers/monthly_archiver.py b/src/extra_mailman_archivers/monthly_archiver.py index 2d5ddc9..c509fd7 100644 --- a/src/extra_mailman_archivers/monthly_archiver.py +++ b/src/extra_mailman_archivers/monthly_archiver.py @@ -73,7 +73,7 @@ class MonthlyArchiver: This archiver saves messages into a maildir for the current year and month, e.g. '2021/April'. - :type mlist: mailman.model.listmanager.ListManager + :type mlist: mailman.interfaces.mailinglist.IMailingList :type message: mailman.email.message.Message """ message_id = message.get('message-id') diff --git a/src/extra_mailman_archivers/pipermail.py b/src/extra_mailman_archivers/pipermail.py index d463bd7..4b9e15a 100644 --- a/src/extra_mailman_archivers/pipermail.py +++ b/src/extra_mailman_archivers/pipermail.py @@ -84,7 +84,12 @@ class Pipermail: return None def archive_message(self, mlist, msg): - """See `IArchiver`.""" + """ + See `IArchiver`. + + :type mlist: mailman.interfaces.mailinglist.IMailingList + :type message: mailman.email.message.Message + """ # Mangle the 'From ' lines and add the Unix envelope header. fp = BytesIO() g = BytesGenerator(fp, mangle_from_=True)