A middleware pipeline is a linked chain of handlers. Each handler does its bit of work and then either passes the request along to the next handler or stops the chain. The base class holds that plumbing so concrete handlers only worry about their own logic.
Implement the default handle behavior on Handler:
class Handler:
def __init__(self):
self._next = None
def set_next(self, handler):
self._next = handler
return handler
def handle(self, request):
"""Default behavior: pass the request to the next handler, or return None."""
# TODO: if self._next is not None: return self._next.handle(request)
# TODO: return None
pass
The editor and the test runner need a wide screen. Open this page on a desktop browser and your progress will be waiting.
A middleware pipeline is a linked chain of handlers. Each handler does its bit of work and then either passes the request along to the next handler or stops the chain. The base class holds that plumbing so concrete handlers only worry about their own logic.
Implement the default handle behavior on Handler:
Press Run Tests or ββ© to check your solution.