Package dns :: Module zone :: Class Zone
[show private | hide private]
[frames | no frames]

Class Zone

object --+
         |
        Zone


A DNS zone.

A Zone is a mapping from names to nodes. The zone object may be treated like a Python dictionary, e.g. zone[name] will retrieve the node associated with that name. The name may be a dns.name.Name object, or it may be a string. In the either case, if the name is relative it is treated as relative to the origin of the zone.
Method Summary
  __init__(self, origin, rdclass)
Initialize a zone object.
  __contains__(self, other)
  __delitem__(self, key)
bool __eq__(self, other)
Two zones are equal if they have the same origin, class, and nodes.
  __getitem__(self, key)
  __getstate__(...)
  __iter__(self)
bool __ne__(self, other)
Are two zones not equal?
a new object with type S, a subtype of T __new__(S, ...)
  __setitem__(self, key, value)
dns.rrset.RRset object find_rdataset(self, name, rdtype, covers)
Look for rdata with the specified name and type in the zone, and return an rdataset encapsulating it.
dns.rrset.RRset object find_rrset(self, name, rdtype, covers)
Look for rdata with the specified name and type in the zone, and return an RRset encapsulating it.
  get(self, key)
  items(self)
  iteritems(self)
  iterkeys(self)
  itervalues(self)
  keys(self)
  values(self)

Instance Variable Summary
  nodes - A dictionary mapping the names of nodes in the zone to the nodes themselves.
  origin - The origin of the zone.
  rdclass - The zone's rdata class; the default is class IN.

Class Variable Summary
list __slots__
class or callable Node - the factory used to create a new node
dict nodes
dns.name.Name object origin
int rdclass

Method Details

__init__(self, origin, rdclass=1)
(Constructor)

Initialize a zone object.
Parameters:
origin - The origin of the zone.
           (type=dns.name.Name object)
rdclass - The zone's rdata class; the default is class IN.
           (type=int)

__eq__(self, other)
(Equality operator)

Two zones are equal if they have the same origin, class, and nodes.
Returns:
bool

__ne__(self, other)

Are two zones not equal?
Returns:
bool

__new__(S, ...)

Returns:
a new object with type S, a subtype of T

find_rdataset(self, name, rdtype, covers=0)

Look for rdata with the specified name and type in the zone, and return an rdataset encapsulating it.

The name, rdtype, and covers parameters may be strings, in which case they will be converted to their proper type.

This routine is more efficient than the similar find_rrset because it does not copy data, but may be less convenient for some uses since rdatasets are not bound to owner names.
Parameters:
name - the owner name to look for
           (type=DNS.name.Name object or string)
rdtype - the rdata type desired
           (type=int or string)
covers - the covered type (defaults to None)
           (type=int or string)
Returns:
dns.rrset.RRset object
Raises:
KeyError - the node or rdata could not be found

find_rrset(self, name, rdtype, covers=0)

Look for rdata with the specified name and type in the zone, and return an RRset encapsulating it.

The name, rdtype, and covers parameters may be strings, in which case they will be converted to their proper type.

This routine is less efficient than the similar find_rdataset because it copies data, but may be more convenient for some uses since it returns an object which binds the owner name to the rdata.
Parameters:
name - the owner name to look for
           (type=DNS.name.Name object or string)
rdtype - the rdata type desired
           (type=int or string)
covers - the covered type (defaults to None)
           (type=int or string)
Returns:
dns.rrset.RRset object
Raises:
KeyError - the node or rdata could not be found

Instance Variable Details

nodes

A dictionary mapping the names of nodes in the zone to the nodes themselves.

origin

The origin of the zone.

rdclass

The zone's rdata class; the default is class IN.

Class Variable Details

__slots__

Type:
list
Value:
['rdclass', 'origin', 'nodes']                                         

Node

Node = dns.node.Node

nodes

Type:
dict
Value:
<member 'nodes' of 'Zone' objects>                                     

origin

Type:
dns.name.Name object
Value:
<member 'origin' of 'Zone' objects>                                    

rdclass

Type:
int
Value:
<member 'rdclass' of 'Zone' objects>                                   

Generated by Epydoc 1.1 on Wed Jul 30 23:38:02 2003 http://epydoc.sf.net