allow keyword arguments for function_class.py

allow keyword arguments for function_class methods
and functions. process_dict_convert_to_instance() is added to
mimic the behavior of the process_list_convert_to_instance()
Derived methods in gnucash_core.py like raise_backend_errors_after_call
get modified to accept being called with keyword args.
Also adds some docstrings.
This commit is contained in:
c-holtermann
2020-06-11 21:11:06 +02:00
parent 4e280b9593
commit b073dbc5c3
2 changed files with 90 additions and 24 deletions

View File

@@ -266,12 +266,12 @@ class Session(GnuCashCoreClass):
# STATIC METHODS
@staticmethod
def raise_backend_errors_after_call(function):
def raise_backend_errors_after_call(function, *args, **kwargs):
"""A function decorator that results in a call to
raise_backend_errors after execution.
"""
def new_function(self, *args):
return_value = function(self, *args)
def new_function(self, *args, **kwargs):
return_value = function(self, *args, **kwargs)
self.raise_backend_errors(function.__name__)
return return_value
return new_function