diff options
| author | Andrew M. Kuchling <amk@amk.ca> | 2006-11-09 13:33:53 (GMT) |
|---|---|---|
| committer | Andrew M. Kuchling <amk@amk.ca> | 2006-11-09 13:33:53 (GMT) |
| commit | d52a0b85830e22d9bde8d3d25e5b047645716497 (patch) | |
| tree | dfaf85b2d31f395ef7d7f97bf2015d4f1f0a41f3 /Lib/mailbox.py | |
| parent | 3f63454e2258f8b187764066fca2cc2a9361b628 (diff) | |
| download | cpython-d52a0b85830e22d9bde8d3d25e5b047645716497.zip cpython-d52a0b85830e22d9bde8d3d25e5b047645716497.tar.gz cpython-d52a0b85830e22d9bde8d3d25e5b047645716497.tar.bz2 | |
[Bug #1569790] mailbox.Maildir.get_folder() loses factory information
Both the Maildir and MH classes had this bug; the patch fixes both classes
and adds a test.
Diffstat (limited to 'Lib/mailbox.py')
| -rwxr-xr-x | Lib/mailbox.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py index eab03af..e66ddde 100755 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -367,12 +367,14 @@ class Maildir(Mailbox): def get_folder(self, folder): """Return a Maildir instance for the named folder.""" - return Maildir(os.path.join(self._path, '.' + folder), create=False) + return Maildir(os.path.join(self._path, '.' + folder), + factory=self._factory, + create=False) def add_folder(self, folder): """Create a folder and return a Maildir instance representing it.""" path = os.path.join(self._path, '.' + folder) - result = Maildir(path) + result = Maildir(path, factory=self._factory) maildirfolder_path = os.path.join(path, 'maildirfolder') if not os.path.exists(maildirfolder_path): os.close(os.open(maildirfolder_path, os.O_CREAT | os.O_WRONLY)) @@ -944,11 +946,13 @@ class MH(Mailbox): def get_folder(self, folder): """Return an MH instance for the named folder.""" - return MH(os.path.join(self._path, folder), create=False) + return MH(os.path.join(self._path, folder), + factory=self._factory, create=False) def add_folder(self, folder): """Create a folder and return an MH instance representing it.""" - return MH(os.path.join(self._path, folder)) + return MH(os.path.join(self._path, folder), + factory=self._factory) def remove_folder(self, folder): """Delete the named folder, which must be empty.""" |
