From: Thomas Jost <schnouki@schnouki.net>
To: notmuch@notmuchmail.org
Subject: [PATCH] python: fix Message.get_filenames()
Date: Fri, 30 Sep 2011 12:16:47 +0200 [thread overview]
Message-ID: <1317377807-20636-1-git-send-email-schnouki@schnouki.net> (raw)
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.
---
bindings/python/notmuch/filename.py | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/bindings/python/notmuch/filename.py b/bindings/python/notmuch/filename.py
index 630886d..b44d4c5 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
--
1.7.6.4
next reply other threads:[~2011-09-30 10:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-30 10:16 Thomas Jost [this message]
2011-09-30 22:41 ` [PATCH] python: fix Message.get_filenames() Sebastian Spaeth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1317377807-20636-1-git-send-email-schnouki@schnouki.net \
--to=schnouki@schnouki.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).