diff --git a/yell/__init__.py b/yell/__init__.py index ab35cdb..86c1035 100644 --- a/yell/__init__.py +++ b/yell/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.3.1" +__version__ = "0.3.2" import registry @@ -12,6 +12,9 @@ def __new__(cls, name, bases, attrs): if Notification.name is not None: registry.notifications[Notification.name] = registry.notifications.get(Notification.name, []) + [Notification] + sendfn = lambda *args, **kwargs: notify(Notification.name, backends = [Notification], *args, **kwargs) + setattr(Notification, 'send', staticmethod(sendfn)) + return Notification diff --git a/yell/tests.py b/yell/tests.py index eeeae0d..3e503f6 100644 --- a/yell/tests.py +++ b/yell/tests.py @@ -72,4 +72,7 @@ def test_notifying_once_with_class(self): self.assertEqual(1, len(results)) self._assert_results(results) - + def test_notifying_with_send_static_method(self): + results = ClassNotification0.send('Arg1', 'Arg2', kwarg1='Kwarg1', kwarg2='Kwarg2') + self.assertEqual(1, len(results)) + self._assert_results(results)