From: Austin Clements Date: Sun, 13 May 2012 19:57:07 +0000 (+2000) Subject: [PATCH 3/5] python: Update for changes to notmuch_database_get_directory X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=baa967515842a352fa62c2bf36eaf1f5c5ff59f5;p=notmuch-archives.git [PATCH 3/5] python: Update for changes to notmuch_database_get_directory --- diff --git a/53/46907abd09af61f0720fcfcddc1847535bdd61 b/53/46907abd09af61f0720fcfcddc1847535bdd61 new file mode 100644 index 000000000..86ed552a1 --- /dev/null +++ b/53/46907abd09af61f0720fcfcddc1847535bdd61 @@ -0,0 +1,118 @@ +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 0A21E431FDA + for ; Sun, 13 May 2012 12:57:27 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 FVJKz5xQqmHX for ; + Sun, 13 May 2012 12:57:24 -0700 (PDT) +Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU + [18.9.25.14]) + by olra.theworths.org (Postfix) with ESMTP id 92333431FAE + for ; Sun, 13 May 2012 12:57:23 -0700 (PDT) +X-AuditID: 1209190e-b7fd86d0000008b4-22-4fb01222f4f7 +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP + id CA.0C.02228.22210BF4; Sun, 13 May 2012 15:57:22 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q4DJvK2w015079; + Sun, 13 May 2012 15:57:20 -0400 +Received: from drake.mit.edu + (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com + [209.6.116.242]) (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q4DJvGoE022910 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Sun, 13 May 2012 15:57:16 -0400 (EDT) +Received: from amthrax by drake.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1STeup-0003et-Tp; Sun, 13 May 2012 15:57:15 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH 3/5] python: Update for changes to + notmuch_database_get_directory +Date: Sun, 13 May 2012 15:57:07 -0400 +Message-Id: <1336939029-13969-4-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1336939029-13969-1-git-send-email-amdragon@mit.edu> +References: <1336939029-13969-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFnrKIsWRmVeSWpSXmKPExsUixCmqrasktMHfYMJ9AYvZrT+YLG60djNa + NE13trh+cyazxZuV81gdWD0Of13I4jHx/Gk2j1v3X7N7PFt1i9ljy6H3zAGsUVw2Kak5mWWp + Rfp2CVwZX5+XF/zgrXi4/iV7A+NKri5GDg4JAROJ340CXYycQKaYxIV769m6GLk4hAT2MUoc + 637DCuFsYJRo2buSHcK5zyTxvWcPVGY+o8TL/r2MIP1sAhoS2/YvB7NFBKQldt6dDVbEDDRd + 4vebZmaQhLBAoMSbP81MILtZBFQlFj30AAnzCjhI/O5bxAxxh7zE0/t9bCA2p4CjxLIrC8Hi + QkA1Jz/+ZZ7AyL+AkWEVo2xKbpVubmJmTnFqsm5xcmJeXmqRrrFebmaJXmpK6SZGcAhK8u1g + /HpQ6RCjAAejEg/vAtH1/kKsiWXFlbmHGCU5mJREedMEN/gL8SXlp1RmJBZnxBeV5qQWH2KU + 4GBWEuFd/xConDclsbIqtSgfJiXNwaIkzqum9c5PSCA9sSQ1OzW1ILUIJivDwaEkwWsIMlSw + KDU9tSItM6cEIc3EwQkynAdoeApIDW9xQWJucWY6RP4Uoy7Hn4eLrjEKseTl56VKifMagBQJ + gBRllObBzYGljleM4kBvCfPuBaniAaYduEmvgJYwAS3hF1gHsqQkESEl1cAoq5L1fUfBpoSf + du5lbqF9uSK3r19lOPfCWOi81JXttxg0LvEv8N507KOJa0TkWeYr7KdaHXawRN+RdH7FnWKq + piDRzD/BVijC4FSnxzWRQ3esRJUfex+a1T9vwhuH0uwVwq26z0w0Wm04q3ZvqO1fuC8nnzOh + lc+sbRPnqdTMJ7L5Et/avyixFGckGmoxFxUnAgDNPhzP+AIAAA== +Cc: tomi.ollila@iki.fi +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: Sun, 13 May 2012 19:57:27 -0000 + +notmuch_database_get_directory now returns +NOTMUCH_STATUS_READ_ONLY_DATABASE on its own (rather than crashing) so +the workaround in Database.get_directory is no longer necessary. +--- + bindings/python/notmuch/database.py | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py +index 0a58dd0..797554d 100644 +--- a/bindings/python/notmuch/database.py ++++ b/bindings/python/notmuch/database.py +@@ -359,13 +359,6 @@ class Database(object): + """ + self._assert_db_is_initialized() + +- # work around libnotmuch calling exit(3), see +- # id:20120221002921.8534.57091@thinkbox.jade-hamburg.de +- # TODO: remove once this issue is resolved +- if self.mode != Database.MODE.READ_WRITE: +- raise ReadOnlyDatabaseError('The database has to be opened in ' +- 'read-write mode for get_directory') +- + # sanity checking if path is valid, and make path absolute + if path and path[0] == os.sep: + # we got an absolute path +@@ -378,7 +371,13 @@ class Database(object): + #we got a relative path, make it absolute + abs_dirpath = os.path.abspath(os.path.join(self.get_path(), path)) + +- dir_p = Database._get_directory(self._db, _str(path)) ++ dir_p = NotmuchDirectoryP() ++ status = Database._get_directory(self._db, _str(path), byref(dir_p)) ++ ++ if status != STATUS.SUCCESS: ++ raise NotmuchError(status) ++ if not dir_p: ++ return None + + # return the Directory, init it with the absolute path + return Directory(abs_dirpath, dir_p, self) +-- +1.7.10 +