again, fix stupid handler has no _request/response_middleware error
This commit is contained in:
parent
b1b801f245
commit
f26a70cfe0
|
@ -139,8 +139,6 @@ class Sanic:
|
||||||
"Middleware mounted on a handler should "
|
"Middleware mounted on a handler should "
|
||||||
"be a function or a sequence of functions"
|
"be a function or a sequence of functions"
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
vars(handler)["_"+r+"_middleware"] = ()
|
|
||||||
|
|
||||||
self.router.add(uri=uri, methods=methods, handler=handler,
|
self.router.add(uri=uri, methods=methods, handler=handler,
|
||||||
host=host, strict_slashes=strict_slashes)
|
host=host, strict_slashes=strict_slashes)
|
||||||
|
@ -480,6 +478,7 @@ class Sanic:
|
||||||
"handler from the router"))
|
"handler from the router"))
|
||||||
|
|
||||||
# request middleware mounted on handler
|
# request middleware mounted on handler
|
||||||
|
if hasattr(handler, "_request_middleware"):
|
||||||
mounted_request_middleware = handler._request_middleware
|
mounted_request_middleware = handler._request_middleware
|
||||||
if mounted_request_middleware:
|
if mounted_request_middleware:
|
||||||
response = await self._handle_mounted_request_middleware(
|
response = await self._handle_mounted_request_middleware(
|
||||||
|
@ -496,6 +495,7 @@ class Sanic:
|
||||||
response = await response
|
response = await response
|
||||||
|
|
||||||
# response middleware mounted on handler
|
# response middleware mounted on handler
|
||||||
|
if hasattr(handler, "_response_middleware"):
|
||||||
mounted_response_middleware = handler._response_middleware
|
mounted_response_middleware = handler._response_middleware
|
||||||
if mounted_response_middleware:
|
if mounted_response_middleware:
|
||||||
response = await self._handle_mounted_response_middleware(
|
response = await self._handle_mounted_response_middleware(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user