From 281936dd027c8561849ae3c5e3c868342b9f97d1 Mon Sep 17 00:00:00 2001 From: Patrick Klein Date: Tue, 17 Apr 2018 14:00:54 -0700 Subject: [PATCH] fix log_decorator for functions without arguments --- resources/lib/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 5b18f96..fd36456 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -36,7 +36,7 @@ def wrapper(*args, **kwargs): # call the function and get the return value ret = func(*args, **kwargs) # define the string for the function call (include class name for methods) - is_method = hasattr(args[0].__class__, func.__name__) + is_method = args and hasattr(args[0].__class__, func.__name__) parent = args[0].__class__.__name__ if is_method \ else func.__module__.replace('resources.lib.', '') func_str = '{0}.{1}'.format(parent, func.__name__)