From 379d2169614e7f4bebd500436a99f113fb798663 Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Wed, 8 Jul 2020 10:32:01 -0700 Subject: [PATCH] Move __str__ to the generic Option code. ECSOption and GenericOption both contained a __str__ method that called to_text(), but the base Option class did not. Move __str__ to the base class. --- dns/edns.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dns/edns.py b/dns/edns.py index 4ad3a5c1..28718d52 100644 --- a/dns/edns.py +++ b/dns/edns.py @@ -135,6 +135,9 @@ class Option: return NotImplemented return self._cmp(other) > 0 + def __str__(self): + return self.to_text() + class GenericOption(Option): @@ -161,8 +164,6 @@ class GenericOption(Option): def from_wire_parser(cls, otype, parser): return cls(otype, parser.get_remaining()) - def __str__(self): - return self.to_text() class ECSOption(Option): """EDNS Client Subnet (ECS, RFC7871)""" @@ -291,9 +292,6 @@ class ECSOption(Option): return cls(addr, src, scope) - def __str__(self): - return self.to_text() - _type_to_class = { OptionType.ECS: ECSOption -- 2.47.3