Part of canonical.launchpad.interfaces.message View In Hierarchy
Known implementations: canonical.launchpad.database.message.MessageSet
Method | get | Return a list of IMessage's with the given rfc822msgid. |
Method | fromText | Construct a Message from a text string and return it. |
Method | fromEmail | Construct a Message from an email message and return it. |
Method | threadMessages | Return a threaded version of supplied message list. |
Method | flattenThreads | Convert threaded messages into a flat, indented form. |
If no such messages exist, raise NotFoundError.
Construct a Message from an email message and return it.
email_message
should be the original email as a string.
owner
specifies the owner of the new Message. The default
is calculated using the From: or Reply-To: headers, and will raise
a UnknownSender error if they cannot be found.
filealias
is the LibraryFileAlias of the raw email if it has
already been stuffed into the Librarian. Default is for this
method to stuff it into the Librarian for you. It should be an
ILibraryFileAlias.
parsed_message
may be an email.Message.Message instance. If given,
it is used internally instead of building one from the raw
email_message. This is purely an optimization step, significant
in many places because the emails we are handling may contain huge
attachments and we should avoid reparsing them if possible.
'fallback_parent' can be specified if you want a parent to be set, if no parent could be identified.
date_created
may be a datetime, and can be specified if you
wish to force the created date for a message. This is
particularly useful when the email_message being passed might
not contain a Date field. Any Date field in the passed message
will be ignored in favour of the value of date_created
.
Return value is a recursive list structure. Each parent entry in the top-level list is a tuple of (parent, children), where children is a list of parents. (Parents may be childless.)
Example: [(parent, [(child1, [(grandchild1, [])]), (child2, [])])]
Take a thread (in the form produced by threadMessages) and iterate through a series of (depth, message) tuples. The ordering will match that implied by the input structure, with all replies to a message appearing after that message.