r19795 - gnucash/trunk/src/optional/python-bindings - Bug #634165: Better dealing with a locked database in python
Christian Stimming
cstim at code.gnucash.org
Wed Nov 10 14:49:21 EST 2010
Author: cstim
Date: 2010-11-10 14:49:21 -0500 (Wed, 10 Nov 2010)
New Revision: 19795
Trac: http://svn.gnucash.org/trac/changeset/19795
Modified:
gnucash/trunk/src/optional/python-bindings/gnucash_core.py
Log:
Bug #634165: Better dealing with a locked database in python
Patch by Christoph Holtermann:
For the second enhancement proposal i have attached a simple patch which adds
the argument ignore_lock to Session.__init__() which is passed through to
qof_session_begin.
This patch extends the function Session.__init__() with ignore_lock
Modified: gnucash/trunk/src/optional/python-bindings/gnucash_core.py
===================================================================
--- gnucash/trunk/src/optional/python-bindings/gnucash_core.py 2010-11-10 19:49:09 UTC (rev 19794)
+++ gnucash/trunk/src/optional/python-bindings/gnucash_core.py 2010-11-10 19:49:21 UTC (rev 19795)
@@ -63,7 +63,7 @@
Invoice..) is associated with a particular book where it is stored.
"""
- def __init__(self, book_uri=None, is_new=False):
+ def __init__(self, book_uri=None, is_new=False, ignore_lock=False):
"""A convienent contructor that allows you to specify a book URI,
begin the session, and load the book.
@@ -78,6 +78,8 @@
is_new is passed to qof_session_begin as the
argument create_if_nonexistent
+ ignore_lock is passed to qof_session
+
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.
@@ -85,7 +87,7 @@
GnuCashCoreClass.__init__(self)
if book_uri is not None:
try:
- self.begin(book_uri, False, is_new)
+ self.begin(book_uri, ignore_lock, is_new)
if not is_new:
self.load()
except GnuCashBackendException, backend_exception:
More information about the gnucash-changes
mailing list