[issue31538] mailbox does not treat external factories the same

2021-06-17 Thread Henk-Jaap Wagenaar


Change by Henk-Jaap Wagenaar :


--
versions: +Python 3.10, Python 3.11 -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31538] mailbox does not treat external factories the same

2021-06-17 Thread Henk-Jaap Wagenaar


Change by Henk-Jaap Wagenaar :


--
keywords: +patch
nosy: +Cryvate
nosy_count: 4.0 -> 5.0
pull_requests: +25362
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26776

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31538] mailbox does not treat external factories the same

2017-09-21 Thread Henk-Jaap Wagenaar

Henk-Jaap Wagenaar added the comment:

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.

--
nosy: +Henk-Jaap Wagenaar

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31538] mailbox does not treat external factories the same

2017-09-20 Thread bpoaugust

New submission from bpoaugust:

The default mailbox factory is mailbox.mboxMessage so I expect the following 
two statements to work the same:

messages = mailbox.mbox("test.mbox")
messages = mailbox.mbox("test.mbox", mailbox.mboxMessage)

However they do not.

The attached file generates the output:


Test
sender@invalid Thu Nov 17 00:49:30 2016
None

Test
MAILER-DAEMON Thu Sep 21 01:31:15 2017
None

Note that the original from has been lost in the second parse.

--
components: email
files: mb.py
messages: 302667
nosy: barry, bpoaugust, r.david.murray
priority: normal
severity: normal
status: open
title: mailbox does not treat external factories the same
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7
Added file: https://bugs.python.org/file47159/mb.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com