class mailbox.MMDF(path, factory=None, create=True)
A subclass of Mailbox
for mailboxes in MMDF format. Parameter factory is a callable object that accepts a file-like message representation (which behaves as if opened in binary mode) and returns a custom representation. If factory is None
, MMDFMessage
is used as the default message representation. If create is True
, the mailbox is created if it does not exist.
MMDF is a single-file mailbox format invented for the Multichannel Memorandum Distribution Facility, a mail transfer agent. Each message is in the same form as an mbox message but is bracketed before and after by lines containing four Control-A ('\001'
) characters. As with the mbox format, the beginning of each message is indicated by a line whose first five characters are “From ”, but additional occurrences of “From ” are not transformed to “>From ” when storing messages because the extra message separator lines prevent mistaking such occurrences for the starts of subsequent messages.
Some Mailbox
methods implemented by MMDF
deserve special remarks:
-
get_file(key)
-
Using the file after calling
flush()
orclose()
on theMMDF
instance may yield unpredictable results or raise an exception.
-
lock()
-
unlock()
-
Three locking mechanisms are used—dot locking and, if available, the
flock()
andlockf()
system calls.
Please login to continue.