r19801 - gnucash/trunk/src/optional/python-bindings - Add force_new parameter to GnuCashCoreClass.__init__, reflecting change to qof_session_begin() in r19798
John Ralls
jralls at code.gnucash.org
Fri Nov 12 13:37:59 EST 2010
Author: jralls
Date: 2010-11-12 13:37:59 -0500 (Fri, 12 Nov 2010)
New Revision: 19801
Trac: http://svn.gnucash.org/trac/changeset/19801
Modified:
gnucash/trunk/src/optional/python-bindings/gnucash_core.py
Log:
Add force_new parameter to GnuCashCoreClass.__init__, reflecting change to qof_session_begin() in r19798
Modified: gnucash/trunk/src/optional/python-bindings/gnucash_core.py
===================================================================
--- gnucash/trunk/src/optional/python-bindings/gnucash_core.py 2010-11-11 20:46:53 UTC (rev 19800)
+++ gnucash/trunk/src/optional/python-bindings/gnucash_core.py 2010-11-12 18:37:59 UTC (rev 19801)
@@ -63,7 +63,8 @@
Invoice..) is associated with a particular book where it is stored.
"""
- def __init__(self, book_uri=None, is_new=False, ignore_lock=False):
+ def __init__(self, book_uri=None, is_new=False, ignore_lock=False,
+ force_new= False):
"""A convienent contructor that allows you to specify a book URI,
begin the session, and load the book.
@@ -75,11 +76,16 @@
qof_session_load is only called if is_new is set to False
- is_new is passed to qof_session_begin as the
- argument create_if_nonexistent
+ is_new is passed to qof_session_begin as the argument create,
+ and force_new as the argument force. Is_new will create a new
+ database or file; force will force creation even if it will
+ destroy and existing dataset.
- ignore_lock is passed to qof_session
+ 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.
+
+
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.
@@ -87,7 +93,7 @@
GnuCashCoreClass.__init__(self)
if book_uri is not None:
try:
- self.begin(book_uri, ignore_lock, is_new)
+ self.begin(book_uri, ignore_lock, is_new, force_new)
if not is_new:
self.load()
except GnuCashBackendException, backend_exception:
More information about the gnucash-changes
mailing list