This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cryvate
Recipients barry, bpoaugust, cryvate, r.david.murray
Date 2017-09-21.10:41:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1505990489.25.0.696649779221.issue31538@psf.upfronthosting.co.za>
In-reply-to
Content
To me the documentation doesn't quite look right, in the case of no factory being passed, it runs:

    def __getitem__(self, key):
        """Return the keyed message; raise KeyError if it doesn't exist."""
        if not self._factory:
            return self.get_message(key)
        else:
            return self._factory(self.get_file(key))

from the Mailbox base class. The get_message is thus:

    def get_message(self, key):
        """Return a Message representation or raise a KeyError."""
        start, stop = self._lookup(key)
        self._file.seek(start)
        from_line = self._file.readline().replace(linesep, b'')
        string = self._file.read(stop - self._file.tell())
        msg = self._message_factory(string.replace(linesep, b'\n'))
        msg.set_from(from_line[5:].decode('ascii'))
        return msg

where self._message_factory is set to mailbox.mboxMessage.

I am not familiar with this module, so am unsure whether the documentation is ill-worded or it is a bug.
History
Date User Action Args
2017-09-21 10:41:29cryvatesetrecipients: + cryvate, barry, r.david.murray, bpoaugust
2017-09-21 10:41:29cryvatesetmessageid: <1505990489.25.0.696649779221.issue31538@psf.upfronthosting.co.za>
2017-09-21 10:41:29cryvatelinkissue31538 messages
2017-09-21 10:41:29cryvatecreate