Python bindings - fix creation of new xml files

This commit is contained in:
Geert Janssens 2014-11-24 11:51:33 +01:00
parent e59c3e0639
commit abf78a202c

View File

@ -102,6 +102,12 @@ class Session(GnuCashCoreClass):
if book_uri is not None: if book_uri is not None:
try: try:
self.begin(book_uri, ignore_lock, is_new, force_new) self.begin(book_uri, ignore_lock, is_new, force_new)
# 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() self.load()
except GnuCashBackendException, backend_exception: except GnuCashBackendException, backend_exception:
self.end() self.end()