From: Brian Wellington Date: Wed, 8 Jul 2020 17:32:01 +0000 (-0700) Subject: Move __str__ to the generic Option code. X-Git-Tag: v2.0.0~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=379d2169614e7f4bebd500436a99f113fb798663;p=thirdparty%2Fdnspython.git 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. --- 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