From 169689f7bbbdfaac053d74ae567fd4967bfe4509 Mon Sep 17 00:00:00 2001 From: Lucas Kanashiro Date: Thu, 6 Aug 2015 14:52:21 -0300 Subject: [PATCH] Fix signals in plugins.utils and plugins.gitlab --- colab/plugins/gitlab/apps.py | 8 ++++++++ colab/plugins/gitlab/signals.py | 15 --------------- colab/plugins/utils/signals.py | 2 +- colab/plugins/utils/tests/test_signals.py | 2 +- 4 files changed, 10 insertions(+), 17 deletions(-) delete mode 100644 colab/plugins/gitlab/signals.py diff --git a/colab/plugins/gitlab/apps.py b/colab/plugins/gitlab/apps.py index df9c0ba..5ab395c 100644 --- a/colab/plugins/gitlab/apps.py +++ b/colab/plugins/gitlab/apps.py @@ -1,5 +1,7 @@ from ..utils.apps import ColabProxiedAppConfig +from colab.plugins.gitlab.tasks import handling_method +from colab.signals.signals import register_signal, connect_signal class ProxyGitlabAppConfig(ColabProxiedAppConfig): @@ -8,3 +10,9 @@ class ProxyGitlabAppConfig(ColabProxiedAppConfig): short_name = 'gitlab' signals_list = ['gitlab_create_project'] + + def register_signal(self): + register_signal(self.short_name, self.signals_list) + + def connect_signal(self): + connect_signal(self.signals_list[0], self.short_name, handling_method) diff --git a/colab/plugins/gitlab/signals.py b/colab/plugins/gitlab/signals.py deleted file mode 100644 index 5c8dc19..0000000 --- a/colab/plugins/gitlab/signals.py +++ /dev/null @@ -1,15 +0,0 @@ -from colab.plugins.utils.signals import AbstractSignal -from colab.plugins.gitlab.tasks import handling_method -from colab.signals.signals import register_signal, connect_signal - - -class GitlabSignals(AbstractSignal): - - short_name = 'gitlab' - signals_list = ['gitlab_create_project'] - - def register_signal(self): - register_signal(self.short_name, self.signals_list) - - def connect_signal(self): - connect_signal(self.signals_list[0], self.short_name, handling_method) diff --git a/colab/plugins/utils/signals.py b/colab/plugins/utils/signals.py index 1c2d7c4..13e8666 100644 --- a/colab/plugins/utils/signals.py +++ b/colab/plugins/utils/signals.py @@ -11,7 +11,7 @@ def _init_signals(method_name): # won't send it explicitly. # If the method doesn't exist we return a dummy function that # won't do anything. - getattr(app, method_name, lambda x: None)(app) + getattr(app, method_name, lambda: None)() def register_signal(): diff --git a/colab/plugins/utils/tests/test_signals.py b/colab/plugins/utils/tests/test_signals.py index 15f9a3a..7ac9880 100644 --- a/colab/plugins/utils/tests/test_signals.py +++ b/colab/plugins/utils/tests/test_signals.py @@ -15,6 +15,6 @@ class SignalsTest(TestCase): mock_app.return_value = apps_list signals._init_signals(method_name) - app_mock.test.assert_called_with(app_mock) + app_mock.test.assert_called_with() self.assertEqual(1, app_mock.test.call_count) self.assertTrue(app_mock.test.called) -- libgit2 0.21.2