2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Make response handlers global by default

Instead of requiring each class inheriting from ResponseHandler to
define its match() method, make the latter non-abstract and default to
returning True for all queries.  This will reduce the amount of
boilerplate code in custom servers.
This commit is contained in:
Michał Kępień
2025-03-25 05:01:34 +01:00
parent 25c91dffcc
commit 75567f86ca

View File

@@ -360,10 +360,13 @@ class ResponseHandler(abc.ABC):
method.
"""
@abc.abstractmethod
# pylint: disable=unused-argument
def match(self, qctx: QueryContext) -> bool:
"""
Matching logic - query is handled when it returns True.
Matching logic - the first handler whose `match()` method returns True
is used for handling the query.
The default for each handler is to handle all queries.
"""
return True