From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 46F3E6DE0946 for ; Sat, 23 Dec 2017 07:59:55 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.011, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id snpF2rQ4jOTk for ; Sat, 23 Dec 2017 07:59:54 -0800 (PST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 1825C6DE00E6 for ; Sat, 23 Dec 2017 07:59:53 -0800 (PST) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1eSmDI-0003Dj-Qz; Sat, 23 Dec 2017 10:59:52 -0500 Received: (nullmailer pid 356 invoked by uid 1000); Sat, 23 Dec 2017 15:59:51 -0000 From: David Bremner To: Ruben Pollan , notmuch@notmuchmail.org Subject: Re: [PATCH] python: add bindings for notmuch_message_get_propert(y/ies) In-Reply-To: <20171129080308.21137-1-meskio@sindominio.net> References: <151194252933.14333.11265370454778979590@localhost> <20171129080308.21137-1-meskio@sindominio.net> Date: Sat, 23 Dec 2017 11:59:51 -0400 Message-ID: <87y3lt8mfc.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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, 23 Dec 2017 15:59:55 -0000 Ruben Pollan writes: > + > + def get_properties(self, prop="", exact=False): As far as I understand, you also need to update docs/source/message.rst so that your new methods are documented in the sphinx docs. > + """ Get the properties for *message*, returning > + notmuch_message_properties_t object which can be used to iterate > + over all properties. This seeems to be wrong (or at last confusing) for the python bindings. > + > + :param prop: The name of the property to get. Otherwise it will return > + the full list of properties of the message. > + :param exact: if True, require exact match with key. Otherwise > + treat as prefix. > + :returns: A dictionary with the property names and values {key: value} > + :raises: :exc:`NotInitializedError` if message has not been > + initialized > + """ > + if not self._msg: > + raise NotInitializedError() > + > + properties_dict = {} > + properties = Message._get_properties(self._msg, prop, exact) Now that the database.get_configs method is merged, I'd prefer to be consistent with that, and define a generator that yields key/value pairs. It's easy enough for someone to use a dictionary comprehension to get a dict from that if they want it. Sorry to be making extra work for you. d