A GnuCash book editing session
To commit changes to the session you may need to call save,
(this is always the case with the file backend).
When you're down with a session you may need to call end()
Every Session has a Book in the book attribute, which you'll definitely
be interested in, as every GnuCash entity (Transaction, Split, Vendor,
Invoice..) is associated with a particular book where it is stored.
Definition at line 62 of file gnucash_core.py.
def python-bindings.gnucash_core.Session.__init__ |
( |
|
self, |
|
|
|
book_uri = None , |
|
|
|
ignore_lock = False , |
|
|
|
is_new = False , |
|
|
|
force_new = False |
|
) |
| |
A convenient constructor that allows you to specify a book URI,
begin the session, and load the book.
This can give you the power of calling
qof_session_new, qof_session_begin, and qof_session_load all in one!
book_uri can be None to skip the calls to qof_session_begin and
qof_session_load, or it can be a string like "file:/test.xac"
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,
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 an existing dataset.
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.
Definition at line 76 of file gnucash_core.py.
78 """A convenient constructor that allows you to specify a book URI,
79 begin the session, and load the book.
81 This can give you the power of calling
82 qof_session_new, qof_session_begin, and qof_session_load all in one!
84 book_uri can be None to skip the calls to qof_session_begin and
85 qof_session_load, or it can be a string like "file:/test.xac"
87 qof_session_load is only called if is_new is set to False
89 is_new is passed to qof_session_begin as the argument create,
90 and force_new as the argument force. Is_new will create a new
91 database or file; force will force creation even if it will
92 destroy an existing dataset.
94 ignore_lock is passed to qof_session_begin's argument of the
95 same name and is used to break an existing lock on a dataset.
99 This function can raise a GnuCashBackendException. If it does,
100 you don't need to cleanup and call end() and destroy(), that is handled
101 for you, and the exception is raised.
103 GnuCashCoreClass.__init__(self)
104 if book_uri
is not None:
106 self.begin(book_uri, ignore_lock, is_new, force_new)
112 if book_uri[:3] !=
"xml" or not is_new:
114 except GnuCashBackendException, backend_exception: