home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import dns.exception as dns
- import dns.rdata as dns
- import dns.name as dns
-
- class RP(dns.rdata.Rdata):
- __slots__ = [
- 'mbox',
- 'txt']
-
- def __init__(self, rdclass, rdtype, mbox, txt):
- super(RP, self).__init__(rdclass, rdtype)
- self.mbox = mbox
- self.txt = txt
-
-
- def to_text(self, origin = None, relativize = True, **kw):
- mbox = self.mbox.choose_relativity(origin, relativize)
- txt = self.txt.choose_relativity(origin, relativize)
- return '%s %s' % (str(mbox), str(txt))
-
-
- def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
- mbox = tok.get_name()
- txt = tok.get_name()
- mbox = mbox.choose_relativity(origin, relativize)
- txt = txt.choose_relativity(origin, relativize)
- tok.get_eol()
- return cls(rdclass, rdtype, mbox, txt)
-
- from_text = classmethod(from_text)
-
- def to_wire(self, file, compress = None, origin = None):
- self.mbox.to_wire(file, None, origin)
- self.txt.to_wire(file, None, origin)
-
-
- def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
- (mbox, cused) = dns.name.from_wire(wire[:current + rdlen], current)
- current += cused
- rdlen -= cused
- if rdlen <= 0:
- raise dns.exception.FormError
- rdlen <= 0
- (txt, cused) = dns.name.from_wire(wire[:current + rdlen], current)
- if cused != rdlen:
- raise dns.exception.FormError
- cused != rdlen
- if origin is not None:
- mbox = mbox.relativize(origin)
- txt = txt.relativize(origin)
-
- return cls(rdclass, rdtype, mbox, txt)
-
- from_wire = classmethod(from_wire)
-
- def choose_relativity(self, origin = None, relativize = True):
- self.mbox = self.mbox.choose_relativity(origin, relativize)
- self.txt = self.txt.choose_relativity(origin, relativize)
-
-
- def _cmp(self, other):
- v = cmp(self.mbox, other.mbox)
- if v == 0:
- v = cmp(self.txt, other.txt)
-
- return v
-
-
-