gnucash maint: Python bindings - fix creation of new xml files

Geert Janssens gjanssens at code.gnucash.org
Mon Nov 24 05:49:20 EST 2014


Updated	 via  https://github.com/Gnucash/gnucash/commit/abf78a20 (commit)
	from  https://github.com/Gnucash/gnucash/commit/e59c3e06 (commit)



commit abf78a202c4898f970ef24159f1a6cecabe0ed00
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Mon Nov 24 11:51:33 2014 +0100

    Python bindings - fix creation of new xml files

diff --git a/src/optional/python-bindings/gnucash_core.py b/src/optional/python-bindings/gnucash_core.py
index 9d80a36..578e800 100644
--- a/src/optional/python-bindings/gnucash_core.py
+++ b/src/optional/python-bindings/gnucash_core.py
@@ -102,7 +102,13 @@ class Session(GnuCashCoreClass):
         if book_uri is not None:
             try:
                 self.begin(book_uri, ignore_lock, is_new, force_new)
-                self.load()
+                # Take care of backend inconsistency
+                # New xml file can't be loaded, new sql store
+                # has to be loaded before it can be altered
+                # Any existing store obviously has to be loaded
+                # More background: https://bugzilla.gnome.org/show_bug.cgi?id=726891
+                if book_uri[:3] != "xml" or not is_new:
+                    self.load()
             except GnuCashBackendException, backend_exception:
                 self.end()
                 self.destroy()



Summary of changes:
 src/optional/python-bindings/gnucash_core.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list