From 0da6b851b0c7af6e528436e5dd562363ab4cfb35 Mon Sep 17 00:00:00 2001 From: c-holtermann Date: Thu, 2 Apr 2020 18:58:52 +0200 Subject: [PATCH] add instance argument to Session constructor if Session is used only as a wrapper for an existing session instance its necessary to be able to pass this instance as an argument --- bindings/python/gnucash_core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bindings/python/gnucash_core.py b/bindings/python/gnucash_core.py index c7a7901e41..76332579a1 100644 --- a/bindings/python/gnucash_core.py +++ b/bindings/python/gnucash_core.py @@ -75,7 +75,7 @@ class Session(GnuCashCoreClass): """ def __init__(self, book_uri=None, ignore_lock=False, is_new=False, - force_new= False): + force_new=False, instance=None): """A convenient constructor that allows you to specify a book URI, begin the session, and load the book. @@ -95,13 +95,15 @@ class Session(GnuCashCoreClass): ignore_lock is passed to qof_session_begin's argument of the same name and is used to break an existing lock on a dataset. + instance argument can be passed if new Session is used as a + wrapper for an existing session instance This function can raise a GnuCashBackendException. If it does, you don't need to cleanup and call end() and destroy(), that is handled for you, and the exception is raised. """ - GnuCashCoreClass.__init__(self) + GnuCashCoreClass.__init__(self, instance=instance) if book_uri is not None: try: self.begin(book_uri, ignore_lock, is_new, force_new)