mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
python: fix Message.get_filenames()
Previously, the Filenames generator only yielded *one* filename before returning, making Message.get_filenames() behave as Message.get_filename(). This commit fixes this incorrect behavior: now the generator yields all the filenames, as expected.
This commit is contained in:
parent
8c51525e82
commit
a859d1c866
1 changed files with 4 additions and 6 deletions
|
@ -82,13 +82,11 @@ class Filenames(object):
|
||||||
if self._files is None:
|
if self._files is None:
|
||||||
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
||||||
|
|
||||||
if not nmlib.notmuch_filenames_valid(self._files):
|
while nmlib.notmuch_filenames_valid(self._files):
|
||||||
self._files = None
|
yield Filenames._get(self._files)
|
||||||
return
|
nmlib.notmuch_filenames_move_to_next(self._files)
|
||||||
|
|
||||||
file = Filenames._get(self._files)
|
self._files = None
|
||||||
nmlib.notmuch_filenames_move_to_next(self._files)
|
|
||||||
yield file
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""Represent Filenames() as newline-separated list of full paths
|
"""Represent Filenames() as newline-separated list of full paths
|
||||||
|
|
Loading…
Reference in a new issue