Package dns :: Module node :: Class Node
[hide private]
[frames] | no frames]

Class Node

source code

object --+
         |
        Node

A Node is a set of rdatasets.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
to_text(self, name, **kw)
Convert a node to text format.
source code
 
__repr__(self)
repr(x)
source code
 
__eq__(self, other) source code
 
__ne__(self, other) source code
 
__len__(self) source code
 
__iter__(self) source code
 
find_rdataset(self, rdclass, rdtype, covers=0, create=False)
Find an rdataset matching the specified properties in the current node.
source code
 
get_rdataset(self, rdclass, rdtype, covers=0, create=False)
Get an rdataset matching the specified properties in the current node.
source code
 
delete_rdataset(self, rdclass, rdtype, covers=0)
Delete the rdataset matching the specified properties in the current node.
source code
 
replace_rdataset(self, replacement)
Replace an rdataset.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  rdatasets

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

to_text(self, name, **kw)

source code 

Convert a node to text format.

Each rdataset at the node is printed. Any keyword arguments to this method are passed on to the rdataset's to_text() method.

*name*, a ``dns.name.Name`` or ``text``, the owner name of the rdatasets.

Returns a ``text``.

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

find_rdataset(self, rdclass, rdtype, covers=0, create=False)

source code 

Find an rdataset matching the specified properties in the current node.

*rdclass*, an ``int``, the class of the rdataset.

*rdtype*, an ``int``, the type of the rdataset.

*covers*, an ``int``, the covered type. Usually this value is dns.rdatatype.NONE, but if the rdtype is dns.rdatatype.SIG or dns.rdatatype.RRSIG, then the covers value will be the rdata type the SIG/RRSIG covers. The library treats the SIG and RRSIG types as if they were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). This makes RRSIGs much easier to work with than if RRSIGs covering different rdata types were aggregated into a single RRSIG rdataset.

*create*, a ``bool``. If True, create the rdataset if it is not found.

Raises ``KeyError`` if an rdataset of the desired type and class does not exist and *create* is not ``True``.

Returns a ``dns.rdataset.Rdataset``.

get_rdataset(self, rdclass, rdtype, covers=0, create=False)

source code 

Get an rdataset matching the specified properties in the current node.

None is returned if an rdataset of the specified type and class does not exist and *create* is not ``True``.

*rdclass*, an ``int``, the class of the rdataset.

*rdtype*, an ``int``, the type of the rdataset.

*covers*, an ``int``, the covered type. Usually this value is dns.rdatatype.NONE, but if the rdtype is dns.rdatatype.SIG or dns.rdatatype.RRSIG, then the covers value will be the rdata type the SIG/RRSIG covers. The library treats the SIG and RRSIG types as if they were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). This makes RRSIGs much easier to work with than if RRSIGs covering different rdata types were aggregated into a single RRSIG rdataset.

*create*, a ``bool``. If True, create the rdataset if it is not found.

Returns a ``dns.rdataset.Rdataset`` or ``None``.

delete_rdataset(self, rdclass, rdtype, covers=0)

source code 

Delete the rdataset matching the specified properties in the current node.

If a matching rdataset does not exist, it is not an error.

*rdclass*, an ``int``, the class of the rdataset.

*rdtype*, an ``int``, the type of the rdataset.

*covers*, an ``int``, the covered type.

replace_rdataset(self, replacement)

source code 

Replace an rdataset.

It is not an error if there is no rdataset matching *replacement*.

Ownership of the *replacement* object is transferred to the node; in other words, this method does not store a copy of *replacement* at the node, it stores *replacement* itself.

*replacement*, a ``dns.rdataset.Rdataset``.

Raises ``ValueError`` if *replacement* is not a ``dns.rdataset.Rdataset``.