Merge pull request #248 from youknowone/debuggable-typecheck

Handle hooks parameters in more debuggable way
This commit is contained in:
Eli Uriegas 2016-12-31 13:17:06 -06:00 committed by GitHub
commit 9f18b5a096

View File

@ -249,13 +249,13 @@ class Sanic:
:param host: Address to host on :param host: Address to host on
:param port: Port to host on :param port: Port to host on
:param debug: Enables debug output (slows server) :param debug: Enables debug output (slows server)
:param before_start: Function to be executed before the server starts :param before_start: Functions to be executed before the server starts
accepting connections accepting connections
:param after_start: Function to be executed after the server starts :param after_start: Functions to be executed after the server starts
accepting connections accepting connections
:param before_stop: Function to be executed when a stop signal is :param before_stop: Functions to be executed when a stop signal is
received before it is respected received before it is respected
:param after_stop: Function to be executed when all requests are :param after_stop: Functions to be executed when all requests are
complete complete
:param sock: Socket for the server to accept connections from :param sock: Socket for the server to accept connections from
:param workers: Number of processes :param workers: Number of processes
@ -293,7 +293,7 @@ class Sanic:
for blueprint in self.blueprints.values(): for blueprint in self.blueprints.values():
listeners += blueprint.listeners[event_name] listeners += blueprint.listeners[event_name]
if args: if args:
if type(args) is not list: if callable(args):
args = [args] args = [args]
listeners += args listeners += args
if reverse: if reverse: