
On 4/19/25 1:55 PM, Mihai Moldovan wrote:
This eventually led me to realize that passing mailman.email.message.Message as the factory to mbox() internally calls factory(msg), and the base class of Message (email.message.Message) has an __init__ function that takes the policy parameter, so it looks as if it's registering the mailbox message incorrectly as the policy handler, which is totally wrong of course.
This appears to be a bug in mailbox.mbox. To work around it, try this:
from email import message_from_bytes
mb = mbox(sys.argv[2], create=False)
for key in mb.iterkeys():
msg = message_from_bytes(mb.get_bytes(key), Message)
and indeed, if I let the import actually happen, it works.
Still, it's probably better if the message is a mailman.email.message.Message object rather than an email.message.Message object.
The imported messages, do have a Message-ID-Hash, but the Archived-At and List-Archive headers are empty (literally <>).
Those headers are added by the rfc_2369 handler based on the archivers configured for the list. They will never point to the prototype archiver or the message in the prototype archive.
Normally they will point to HyperKitty and to the archived message in HyperKitty. This is the case even for messages in the prototype archiver as those messages are just the message as delivered to the list members absent any personalization.
Do you have an example message that was archived through Prototype? What are the proper header values for this module? I believe that Archived-At should be the Message-ID-Hash and the List-Archive header contain... well, given that the Prototype archiver is not meant to be publicly available, probably a file:// URL?
Typically they will be something like
List-Archive: <https://example.com/archives/list/listname@example.com/> Archived-At: <https://example.com/archives/list/listname@example.com/message/xxxxxx/>
where xxxxxx is the message-id hash value.
Note that the generation of these headers by the rfc_2369 handler depends on this script being run in an installation that has hyperkitty and mailman-hyperkitty installed and the hyperkitty archiver enabled for the list.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan