From 3ab66623cda4b65630e2c0902a231eb9c8a45624 Mon Sep 17 00:00:00 2001 From: Christoph Holtermann Date: Fri, 7 Sep 2018 00:09:47 +0200 Subject: [PATCH] Bug 796137 - implement search_for as method of Python Query The last three commits fix the main part of Bug 796137. An inconvenience with GSList remains as for the moment qof_query_add_boolean_match only accepts bytes as parameter and no strings. This still needs to be fixed. --- bindings/python/gnucash_core.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bindings/python/gnucash_core.py b/bindings/python/gnucash_core.py index 6420a176a1..bcd34f742c 100644 --- a/bindings/python/gnucash_core.py +++ b/bindings/python/gnucash_core.py @@ -760,12 +760,19 @@ from gnucash.gnucash_core_c import \ INVOICE_IS_PAID class Query(GnuCashCoreClass): - pass -Query.add_constructor_and_methods_with_prefix('qof_query_', 'create') + def search_for(self, obj_type): + """Set search_for to obj_type + + calls qof_query_search_for. Buffers search string for queries lifetime. + @see https://bugs.gnucash.org/show_bug.cgi?id=796137""" + self.__search_for_buf = obj_type + self._search_for(self.__search_for_buf) + +Query.add_constructor_and_methods_with_prefix('qof_query_', 'create', exclude=["qof_query_search_for"]) Query.add_method('qof_query_set_book', 'set_book') -Query.add_method('qof_query_search_for', 'search_for') +Query.add_method('qof_query_search_for', '_search_for') Query.add_method('qof_query_run', 'run') Query.add_method('qof_query_add_term', 'add_term') Query.add_method('qof_query_add_boolean_match', 'add_boolean_match')