From 1b65b2e0c658dc0e87a5a93f3e3665782b01edef Mon Sep 17 00:00:00 2001 From: Pahaz Blinov Date: Sun, 6 Nov 2016 21:08:55 +0500 Subject: [PATCH] fix(blueprints): @middleware IndexError (#139) --- sanic/blueprints.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sanic/blueprints.py b/sanic/blueprints.py index c9c54b62..bfef8557 100644 --- a/sanic/blueprints.py +++ b/sanic/blueprints.py @@ -109,8 +109,9 @@ class Blueprint: # Detect which way this was called, @middleware or @middleware('AT') if len(args) == 1 and len(kwargs) == 0 and callable(args[0]): + middleware = args[0] args = [] - return register_middleware(args[0]) + return register_middleware(middleware) else: return register_middleware