On 5/29/25 09:49, Thomas Ward via Mailman-Developers wrote:
When we get to the TID_PATTERN.search(message_subject)[0] line though,
we get an error about it expecting a string or bytes like object.
So, I need some information (hint: type hinting in your examples, etc.
would be wonderful):
(1) What is the datatype of `msg` in the archive_message class? Is it
an email.message.EmailMessage or email.message.Message or some Mailman
datatype representation of a message?
It is a mailman.email.message.Message object which is a subclass of
email.message.Message that overrides the as_string() and as_bytes()
methods to work around a couple of bugs and adds a couple of methods.
See
https://gitlab.com/mailman/mailman/-/blob/master/src/mailman/email/message.py?ref_type=heads
(2) If the msg datatype is not of email.message.Message or
email.message.EmailMessage, how should we go about getting data and
headers *out* of the message for the process?
All the things you would use on an email.message.Message object should
work on a mailman.email.message.Message object.
I have no idea why
message_subject = msg.get('Subject', '(No Subject)')
would not set message_subject to a string.
Perhaps you can log `msg.as_string()` or other things to inspect the msg
object.
--
Mark Sapiro <m...@msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
_______________________________________________
Mailman-Developers mailing list -- mailman-developers@python.org
To unsubscribe send an email to mailman-developers-le...@python.org
https://mail.python.org/mailman3/lists/mailman-developers.python.org/
Mailman FAQ: https://wiki.list.org/x/AgA3
Security Policy: https://wiki.list.org/x/QIA9