X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=bindings%2Fpython%2Fnotmuch%2Ffilename.py;h=de4d785ad6085ddfd3fbf42ebe54ae33d5ca76c7;hp=a16e717e778d80fa4c9236ad94249c10ce237ceb;hb=a859d1c8668d9bec03f2b9525c7029c578c1b427;hpb=19daa117b90289d724392e04e3647ade6db4dd7b diff --git a/bindings/python/notmuch/filename.py b/bindings/python/notmuch/filename.py index a16e717e..de4d785a 100644 --- a/bindings/python/notmuch/filename.py +++ b/bindings/python/notmuch/filename.py @@ -82,13 +82,11 @@ class Filenames(object): if self._files is None: raise NotmuchError(STATUS.NOT_INITIALIZED) - if not nmlib.notmuch_filenames_valid(self._files): - self._files = None - return + while nmlib.notmuch_filenames_valid(self._files): + yield Filenames._get(self._files) + nmlib.notmuch_filenames_move_to_next(self._files) - file = Filenames._get(self._files) - nmlib.notmuch_filenames_move_to_next(self._files) - yield file + self._files = None def __str__(self): """Represent Filenames() as newline-separated list of full paths