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 0BF1A431FC3 for ; Sat, 28 Apr 2012 15:18:00 -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 TfNt1WOmdbhq for ; Sat, 28 Apr 2012 15:17:59 -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 5894D431FAE for ; Sat, 28 Apr 2012 15:17:59 -0700 (PDT) X-AuditID: 12074424-b7fae6d000000906-dc-4f9c6c96815a Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP id 15.EE.02310.69C6C9F4; Sat, 28 Apr 2012 18:17:58 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q3SMHwwU007742; Sat, 28 Apr 2012 18:17:58 -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 q3SMHv2p008921 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 28 Apr 2012 18:17:58 -0400 (EDT) Received: from amthrax by drake.mit.edu with local (Exim 4.77) (envelope-from ) id 1SOFxl-00058M-AY; Sat, 28 Apr 2012 18:17:57 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 4/6] python: Update Python bindings for new notmuch_database_{open, create} signatures Date: Sat, 28 Apr 2012 18:17:51 -0400 Message-Id: <1335651473-19652-5-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1335651473-19652-1-git-send-email-amdragon@mit.edu> References: <1335651473-19652-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRmVeSWpSXmKPExsUixG6nrjstZ46/weVdNhbXb85kdmD0eLbq FnMAYxSXTUpqTmZZapG+XQJXxquZG5gKFotULFl9g7mB8TFfFyMnh4SAicTG/k52CFtM4sK9 9WwgtpDAPkaJviWMEPYGRolja4DiXED2fSaJIzc3QTnzGSUWtkFUsQloSGzbvxzMFhGQlth5 dzZrFyMHB7OAmsSfLhUQU1ggVeL3ZCGQChYBVYlpjf/AdvEKOEi0vX/PDHGDgsSzdceZQGxO AUeJ/5tPsEPc4CDRMW8C2wRG/gWMDKsYZVNyq3RzEzNzilOTdYuTE/PyUot0zfVyM0v0UlNK NzGCA8ZFZQdj8yGlQ4wCHIxKPLy7sub4C7EmlhVX5h5ilORgUhLlZQEJ8SXlp1RmJBZnxBeV 5qQWH2KU4GBWEuHVFgfK8aYkVlalFuXDpKQ5WJTEeTW03vkJCaQnlqRmp6YWpBbBZGU4OJQk eFuzgRoFi1LTUyvSMnNKENJMHJwgw3mAhu8BqeEtLkjMLc5Mh8ifYlSUEuddD5IQAElklObB 9cIi+hWjONArwrzTQap4gMkArvsV0GAmoMFMnrNABpckIqSkGhinbRbKr+tyKMvSqJtccD5d c+v2f5OvV8oK/zNRmjH7/Mb2fEclj5y2jhtGLx6K/JvRHu+wsvCr1fJ/fG6ey8/5Pg9xe3/f UfDSn32tiTkuF1YcmRJuF2dqrTi5+W18h0+3CNv+NpsP5zbJvpx48YYf9/mWPQ+6rd+Kueal KmmuY7F+c0fz2CElluKMREMt5qLiRADXUaHBwwIAAA== 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: Sat, 28 Apr 2012 22:18:00 -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