From 3b1831885a5f0f3cd07512e9a5fa3769620a76fb Mon Sep 17 00:00:00 2001 From: MarkusMeskanen Date: Sun, 6 Dec 2015 18:01:38 +0200 Subject: [PATCH] Added kwargs and return values to filters and hooks --- .../source-python/packages/source-python/commands/filter.py | 4 ++-- addons/source-python/packages/source-python/hooks/base.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/source-python/packages/source-python/commands/filter.py b/addons/source-python/packages/source-python/commands/filter.py index 2d8f8311a..ece553448 100644 --- a/addons/source-python/packages/source-python/commands/filter.py +++ b/addons/source-python/packages/source-python/commands/filter.py @@ -31,9 +31,9 @@ def __init__(self, callback): # Register the filter self._manager_class.register_filter(self.callback) - def __call__(self, *args): + def __call__(self, *args, **kwargs): """Call the callback.""" - self.callback(*args) + return self.callback(*args, **kwargs) def _unload_instance(self): """Unregister the filter.""" diff --git a/addons/source-python/packages/source-python/hooks/base.py b/addons/source-python/packages/source-python/hooks/base.py index c299a6d92..9a006043b 100644 --- a/addons/source-python/packages/source-python/hooks/base.py +++ b/addons/source-python/packages/source-python/hooks/base.py @@ -83,9 +83,9 @@ def __init__(self, callback): self.callback = callback self._class_instance.append(self.callback) - def __call__(self, *args): + def __call__(self, *args, **kwargs): """Call the callback.""" - self.callback(*args) + return self.callback(*args, **kwargs) def _unload_instance(self): """Unregister the hook."""