mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user