Update deprecation message
Fix bug with single callbacks
This commit is contained in:
parent
ee6ff0cc60
commit
2340910b46
|
@ -478,8 +478,8 @@ class Sanic:
|
||||||
if debug:
|
if debug:
|
||||||
warnings.simplefilter('default')
|
warnings.simplefilter('default')
|
||||||
warnings.warn("Passing a before_start, before_stop, after_start or"
|
warnings.warn("Passing a before_start, before_stop, after_start or"
|
||||||
"after_stop callback will be deprecated in version"
|
"after_stop callback will be deprecated in next "
|
||||||
" 0.4.0",
|
"major version after 0.4.0",
|
||||||
DeprecationWarning)
|
DeprecationWarning)
|
||||||
|
|
||||||
self.error_handler.debug = debug
|
self.error_handler.debug = debug
|
||||||
|
@ -514,6 +514,9 @@ class Sanic:
|
||||||
):
|
):
|
||||||
listeners = self.listeners[event_name].copy()
|
listeners = self.listeners[event_name].copy()
|
||||||
if args:
|
if args:
|
||||||
|
if callable(args):
|
||||||
|
listeners.append(args)
|
||||||
|
else:
|
||||||
listeners.extend(args)
|
listeners.extend(args)
|
||||||
if reverse:
|
if reverse:
|
||||||
listeners.reverse()
|
listeners.reverse()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user