Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 98FFB431FD0 for ; Fri, 30 Sep 2011 03:17:05 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ao3TbxWQgW+d for ; Fri, 30 Sep 2011 03:17:03 -0700 (PDT) Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222]) by olra.theworths.org (Postfix) with ESMTP id 6B067431FB6 for ; Fri, 30 Sep 2011 03:17:03 -0700 (PDT) Received: from localhost.localdomain (thor.loria.fr [152.81.12.250]) by ks3536.kimsufi.com (Postfix) with ESMTPSA id 1686E6A069B; Fri, 30 Sep 2011 12:17:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net; s=key-schnouki; t=1317377821; bh=bNbNoZdA5DRCJR8sCBRtVdRRY67iYkU5mEXCnUpoUY8=; h=From:To:Subject:Date:Message-Id; b=XoVcF6XvD2SCl4S3qFbD+yhYQYyWAQPYbq401IyTDWCx+XPKQXwv6CV9REVqeeIuH 0qf7klkJPCuLnoyCGRWy/KoFhIDneo4o2WtVgjLsv+lsqOZYzkXy6Dw79kecnvwxTY cGEfswcRyJC+Ja4I1HOB3QYOBRuB+7q5scFiBL30= From: Thomas Jost To: notmuch@notmuchmail.org Subject: [PATCH] python: fix Message.get_filenames() Date: Fri, 30 Sep 2011 12:16:47 +0200 Message-Id: <1317377807-20636-1-git-send-email-schnouki@schnouki.net> X-Mailer: git-send-email 1.7.6.4 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2011 10:17:05 -0000 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