From a6f464faae11b21aa33a031dbd900735bd358d80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Fri, 11 Jun 2021 17:36:24 +0200
Subject: [PATCH] 2.17.5 and passes tests

---
 satella/coding/decorators/decorators.py | 8 +++++---
 tests/test_coding/test_decorators.py    | 4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/satella/coding/decorators/decorators.py b/satella/coding/decorators/decorators.py
index a908b7b0..a17c4245 100644
--- a/satella/coding/decorators/decorators.py
+++ b/satella/coding/decorators/decorators.py
@@ -338,6 +338,8 @@ def call_method_on_exception(exc_classes, method_name, *args, **kwargs):
     Exception class determination is done by isinstance, so you can go wild with metaclassing.
     Exception will be swallowed. The return value will be taken from the called function.
 
+    Note that the called method must be an instance method.
+
     :param exc_classes: a tuple or an instance class to which react
     :param method_name: name of the method. It must be gettable by getattr
     :param args: arguments to pass to given method
@@ -345,12 +347,12 @@ def call_method_on_exception(exc_classes, method_name, *args, **kwargs):
     """
     def outer(fun):
         @wraps(fun)
-        def inner(self, *args, **kwargs):
+        def inner(self, *f_args, **f_kwargs):
             try:
-                return fun(self, *args, **kwargs)
+                return fun(self, *f_args, **f_kwargs)
             except Exception as e:
                 if isinstance(e, exc_classes):
-                    return getattr(self, method_name)(self, *args, **kwargs)
+                    return getattr(self, method_name)(*args, **kwargs)
                 else:
                     raise
         return inner
diff --git a/tests/test_coding/test_decorators.py b/tests/test_coding/test_decorators.py
index 857ac320..0826265a 100644
--- a/tests/test_coding/test_decorators.py
+++ b/tests/test_coding/test_decorators.py
@@ -33,8 +33,8 @@ class TestDecorators(unittest.TestCase):
             def do(self):
                 raise ValueError()
 
-        a = Test()
-        a.do()
+        c = Test()
+        c.do()
         self.assertTrue(a['called'])
 
     def test_cached_memoizer(self):
-- 
GitLab