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 9951C429E3F for ; Mon, 30 Apr 2012 09:25:45 -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 PzfAeCKQVwmj for ; Mon, 30 Apr 2012 09:25:44 -0700 (PDT) Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU [18.7.68.36]) by olra.theworths.org (Postfix) with ESMTP id BB4FD431FAF for ; Mon, 30 Apr 2012 09:25:44 -0700 (PDT) X-AuditID: 12074424-b7fae6d000000906-eb-4f9ebd08a482 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP id A1.7E.02310.80DBE9F4; Mon, 30 Apr 2012 12:25:44 -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 q3UGPiYH029836; Mon, 30 Apr 2012 12:25:44 -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 q3UGPgZ1005258 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 30 Apr 2012 12:25:43 -0400 (EDT) Received: from amthrax by drake.mit.edu with local (Exim 4.77) (envelope-from ) id 1SOtPy-0006HD-0T; Mon, 30 Apr 2012 12:25:42 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v2 4/6] python: Update Python bindings for new notmuch_database_{open, create} signatures Date: Mon, 30 Apr 2012 12:25:36 -0400 Message-Id: <1335803138-24024-5-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1335803138-24024-1-git-send-email-amdragon@mit.edu> References: <1335651473-19652-1-git-send-email-amdragon@mit.edu> <1335803138-24024-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMIsWRmVeSWpSXmKPExsUixCmqrcuxd56/wYl34hbXb85kdmD0eLbq FnMAYxSXTUpqTmZZapG+XQJXxquZG5gKFotULFl9g7mB8TFfFyMnh4SAicS52c8YIWwxiQv3 1rN1MXJxCAnsY5T4cOgmI4SzgVHi1uJD7BDOfSaJtVPPQZXNZ5TYcvMbG0g/m4CGxLb9y8Fm iQhIS+y8O5u1i5GDg1lATeJPlwpIWFggQ2LSmqlMIDaLgKrEp1UrWEFsXgEHiY19G5ggzlCQ eLbuOJjNKeAocevANxYQW0igXGLjhU+MExj5FzAyrGKUTcmt0s1NzMwpTk3WLU5OzMtLLdI1 18vNLNFLTSndxAgKG3YXlR2MzYeUDjEKcDAq8fC+XDjPX4g1say4MvcQoyQHk5Ior+4eoBBf Un5KZUZicUZ8UWlOavEhRgkOZiUR3tKJQDnelMTKqtSifJiUNAeLkjivhtY7PyGB9MSS1OzU 1ILUIpisDAeHkgSvPchQwaLU9NSKtMycEoQ0EwcnyHAeoOFgNbzFBYm5xZnpEPlTjIpS4rwM IAkBkERGaR5cLyyuXzGKA70izCsBUsUDTAlw3a+ABjMBDc43BxtckoiQkmpgPFzhNnHxYqOs aUvTVpoHLH7Oubz/d8WH+tblqe4Od6JFKkIs4u3t5uxWPZe9qmxGv73SZWuLL2ZV0SHbHn5u mBXvNa372ovn0x6s6C49NTM/nkdz5b3nj7a8qCpxmfZiijDLIotTLI1TLZ9FOCcw7mHlX7bF /nZCY4uNLOdpQ8nCfx91sxrPKbEUZyQaajEXFScCAOYG0czGAgAA 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: Mon, 30 Apr 2012 16:25:45 -0000 --- bindings/python/notmuch/database.py | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 268e952..adc0a3f 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -95,8 +95,8 @@ class Database(object): """notmuch_database_open""" _open = nmlib.notmuch_database_open - _open.argtypes = [c_char_p, c_uint] - _open.restype = NotmuchDatabaseP + _open.argtypes = [c_char_p, c_uint, POINTER(NotmuchDatabaseP)] + _open.restype = c_uint """notmuch_database_upgrade""" _upgrade = nmlib.notmuch_database_upgrade @@ -122,8 +122,8 @@ class Database(object): """notmuch_database_create""" _create = nmlib.notmuch_database_create - _create.argtypes = [c_char_p] - _create.restype = NotmuchDatabaseP + _create.argtypes = [c_char_p, POINTER(NotmuchDatabaseP)] + _create.restype = c_uint def __init__(self, path = None, create = False, mode = MODE.READ_ONLY): @@ -193,12 +193,13 @@ class Database(object): raise NotmuchError(message="Cannot create db, this Database() " "already has an open one.") - res = Database._create(_str(path), Database.MODE.READ_WRITE) + db = NotmuchDatabaseP() + status = Database._create(_str(path), Database.MODE.READ_WRITE, byref(db)) - if not res: - raise NotmuchError( - message="Could not create the specified database") - self._db = res + if status != STATUS.SUCCESS: + raise NotmuchError(status) + self._db = db + return status def open(self, path, mode=0): """Opens an existing database @@ -212,11 +213,13 @@ class Database(object): :raises: Raises :exc:`NotmuchError` in case of any failure (possibly after printing an error message on stderr). """ - res = Database._open(_str(path), mode) + db = NotmuchDatabaseP() + status = Database._open(_str(path), mode, byref(db)) - if not res: - raise NotmuchError(message="Could not open the specified database") - self._db = res + if status != STATUS.SUCCESS: + raise NotmuchError(status) + self._db = db + return status _close = nmlib.notmuch_database_close _close.argtypes = [NotmuchDatabaseP] -- 1.7.9.1