Account for BP with exception handler but no routes (#2246)

This commit is contained in:
Adam Hopkins
2021-09-29 13:47:31 +03:00
committed by GitHub
parent 6ffc4d9756
commit ba2670e99c
2 changed files with 59 additions and 7 deletions

View File

@@ -331,21 +331,22 @@ class Blueprint(BaseSanic):
route_names = [route.name for route in routes if route]
# Middleware
if route_names:
# Middleware
for future in self._future_middleware:
middleware.append(app._apply_middleware(future, route_names))
# Exceptions
for future in self._future_exceptions:
exception_handlers.append(
app._apply_exception_handler(future, route_names)
)
# Exceptions
for future in self._future_exceptions:
exception_handlers.append(
app._apply_exception_handler(future, route_names)
)
# Event listeners
for listener in self._future_listeners:
listeners[listener.event].append(app._apply_listener(listener))
# Signals
for signal in self._future_signals:
signal.condition.update({"blueprint": self.name})
app._apply_signal(signal)