Opened 7 years ago

Closed 7 years ago

#6975 enhancement closed fixed (fixed)

twisted.names.dns._EDNSMessage should use the same repr mechanism as dns.Message

Reported by: Richard Wall Owned by: Richard Wall
Priority: normal Milestone: EDNS0
Component: names Keywords:
Cc: Branch: branches/concise-ednsmessage-repr-6975
branch-diff, diff-cov, branch-cov, buildbot
Author: rwall


In ticket:6847#comment:8 suggested only showing non-default attribute values in the dns.Message repr.

It works really well, so I now want to apply the same mechanism to dns._EDNSMessage.

I'll refactor the code so that this "meaningful yet succinct" repr code can be shared and can be applied to other dns classes eg RRHeader and _OPTHeader.

See source:trunk/twisted/names/

Change History (5)

comment:1 Changed 7 years ago by Richard Wall

Author: rwall
Branch: branches/concise-ednsmessage-repr-6975

(In [41692]) Branching to 'concise-ednsmessage-repr-6975'

comment:2 Changed 7 years ago by Richard Wall

Keywords: review added
Owner: Richard Wall deleted

Ready for review in log:branches/concise-ednsmessage-repr-6975

  • Refactored the dns.Message.repr code so that it can be shared and re-used in _EDNSMessage.repr
  • Added an alwaysShow option to make the function flexible enough for use with classes other than dns messages.
  • Duplicated the dns.Message.repr tests for _EDNSMessage.repr
  • Added dedicated tests for the new _compactRepr function.

In future, this new function could also be used in dns.RRHeader, dns._OPTHeader, dns._OPTVariableOption and maybe even the dns.Record_XXX classes. In those cases, "sectionNames" makes no sense, but those can be done in separate tickets.

Build Results:

comment:4 Changed 7 years ago by Glyph

Keywords: review removed
Owner: set to Richard Wall

Very nice. Not a whole lot to comment on here; just a better implementation. Please merge :).

comment:5 Changed 7 years ago by Richard Wall

Resolution: fixed
Status: newclosed

(In [41737]) Merge concise-ednsmessage-repr-6975

Author: rwall Reviewer: glyph Fixes: #6975

dns._EDNSMessage.repr now only shows non-default attribute values making it more concise and easier to read.

Note: See TracTickets for help on using tickets.