aboutsummaryrefslogtreecommitdiffhomepage
path: root/bindings
diff options
context:
space:
mode:
authorGravatar Thomas Jost <schnouki@schnouki.net>2011-09-30 12:16:47 +0200
committerGravatar Sebastian Spaeth <Sebastian@SSpaeth.de>2011-10-01 00:40:20 +0200
commita859d1c8668d9bec03f2b9525c7029c578c1b427 (patch)
tree8f1aaa036b9e3dbb8b907a0ad094b383a3ffd314 /bindings
parent8c51525e8213e074a845ad53d7196453952623dd (diff)
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.
Diffstat (limited to 'bindings')
-rw-r--r--bindings/python/notmuch/filename.py10
1 files changed, 4 insertions, 6 deletions
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