From 2340910b4632ca48f5c968907226e6c1095b2e2b Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Sun, 12 Feb 2017 18:15:14 +0000 Subject: [PATCH] Update deprecation message Fix bug with single callbacks --- sanic/sanic.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sanic/sanic.py b/sanic/sanic.py index dec6d10b..1f2a6921 100644 --- a/sanic/sanic.py +++ b/sanic/sanic.py @@ -478,8 +478,8 @@ class Sanic: if debug: warnings.simplefilter('default') warnings.warn("Passing a before_start, before_stop, after_start or" - "after_stop callback will be deprecated in version" - " 0.4.0", + "after_stop callback will be deprecated in next " + "major version after 0.4.0", DeprecationWarning) self.error_handler.debug = debug @@ -514,7 +514,10 @@ class Sanic: ): listeners = self.listeners[event_name].copy() if args: - listeners.extend(args) + if callable(args): + listeners.append(args) + else: + listeners.extend(args) if reverse: listeners.reverse() # Prepend sanic to the arguments when listeners are triggered