diff options
Diffstat (limited to 'dns/rdtypes/ANY/NSEC.py')
-rw-r--r-- | dns/rdtypes/ANY/NSEC.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/dns/rdtypes/ANY/NSEC.py b/dns/rdtypes/ANY/NSEC.py index 2d8b367..ee9a009 100644 --- a/dns/rdtypes/ANY/NSEC.py +++ b/dns/rdtypes/ANY/NSEC.py @@ -29,7 +29,7 @@ class NSEC(dns.rdata.Rdata): @type windows: list of (window number, string) tuples""" __slots__ = ['next', 'windows'] - + def __init__(self, rdclass, rdtype, next, windows): super(NSEC, self).__init__(rdclass, rdtype) self.next = next @@ -48,16 +48,16 @@ class NSEC(dns.rdata.Rdata): i * 8 + j)) text += (' ' + ' '.join(bits)) return '%s%s' % (next, text) - + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): next = tok.get_name() next = next.choose_relativity(origin, relativize) rdtypes = [] while 1: - (ttype, value) = tok.get() - if ttype == dns.tokenizer.EOL or ttype == dns.tokenizer.EOF: + token = tok.get() + if token.is_eol_or_eof(): break - nrdtype = dns.rdatatype.from_text(value) + nrdtype = dns.rdatatype.from_text(token.value) if nrdtype == 0: raise dns.exception.SyntaxError, "NSEC with bit 0" if nrdtype > 65535: @@ -85,7 +85,7 @@ class NSEC(dns.rdata.Rdata): bitmap[byte] = chr(ord(bitmap[byte]) | (0x80 >> bit)) windows.append((window, ''.join(bitmap[0:octets]))) return cls(rdclass, rdtype, next, windows) - + from_text = classmethod(from_text) def to_wire(self, file, compress = None, origin = None): @@ -94,7 +94,7 @@ class NSEC(dns.rdata.Rdata): file.write(chr(window)) file.write(chr(len(bitmap))) file.write(bitmap) - + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): (next, cused) = dns.name.from_wire(wire[: current + rdlen], current) current += cused @@ -123,7 +123,7 @@ class NSEC(dns.rdata.Rdata): def choose_relativity(self, origin = None, relativize = True): self.next = self.next.choose_relativity(origin, relativize) - + def _cmp(self, other): v = cmp(self.next, other.next) if v == 0: |