enable Session.__init__() to be provided with existing instance or book

This commit is contained in:
c-holtermann
2020-06-19 19:15:51 +02:00
parent 5833c5afcb
commit 44e61f4df2

View File

@@ -210,7 +210,12 @@ class Session(GnuCashCoreClass):
you don't need to cleanup and call end() and destroy(), that is handled
for you, and the exception is raised.
"""
GnuCashCoreClass.__init__(self, Book())
if instance is not None:
GnuCashCoreClass.__init__(self, instance=instance)
else:
if book is None:
book = Book()
GnuCashCoreClass.__init__(self, book)
if book_uri is not None:
try: