From bb8041e0fd56336b13b22824ad5f386b891a85d2 Mon Sep 17 00:00:00 2001 From: "Vgr E. Barry" Date: Wed, 4 Nov 2015 14:19:02 -0500 Subject: [PATCH] Fixed some protected functions not working --- src/decorators.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/decorators.py b/src/decorators.py index fee4623..72becde 100644 --- a/src/decorators.py +++ b/src/decorators.py @@ -20,16 +20,16 @@ HOOKS = defaultdict(list) # Error handler decorators class handle_error: + + instance = None + owner = object + def __new__(cls, func): if isinstance(func, cls): # already decorated return func self = super().__new__(cls) - self.func = func - self.instance = None - self.owner = object - return self def __get__(self, instance, owner): @@ -39,7 +39,7 @@ class handle_error: def __call__(self, *args, **kwargs): try: - self.func.__get__(self.instance, self.owner)(*args, **kwargs) + return self.func.__get__(self.instance, self.owner)(*args, **kwargs) except Exception: traceback.print_exc() # no matter what, we want it to print if kwargs.get("cli"): # client