Package nss :: Module nss :: Class RDN
[hide private]
[frames] | no frames]

type RDN

object --+
         |
        RDN

An object representing an X501 Relative Distinguished Name (e.g. RDN).

RDN objects contain an ordered list of AVA objects.

Examples:

RDN()
RDN(nss.AVA('cn', 'www.redhat.com'))
RDN([ava0, ava1])

The RDN object constructor may be invoked with zero or more AVA objects, or you may optionally pass a list or tuple of AVA objects.

RDN objects contain an ordered list of AVA objects. The RDN object has both sequence and mapping behaviors with respect to the AVA's they contain. Thus you can index an AVA by position, by name, or by SecItem (if it's an OID). You can iterate over the list, get it's length or take a slice.

If you index by string the string may be either a canonical name for the AVA type (e.g. 'cn') or the dotted-decimal notation for the OID (e.g. 2.5.4.3). There may be multiple AVA's in a RDN whose type matches (e.g. OU=engineering+OU=boston). It is not common to have more than one AVA in a RDN with the same type. However because of the possiblity of being multi-valued when indexing by type a list is always returned containing the matching AVA's. Thus:

rdn = nss.RDN(nss.AVA('OU', 'engineering'))
rdn['ou']
    returns [AVA('OU=engineering')

rdn = nss.RDN(nss.AVA('OU', 'engineering'), nss.AVA('OU', 'boston'))
rdn['ou']
    returns [AVA('OU=boston'), AVA('OU=engineering')]

Examples:

rdn = nss.RDN(nss.AVA('cn', 'www.redhat.com'))
str(rdn)
   returns 'CN=www.redhat.com'
rdn[0]
   returns an `AVA` object with the value C=US
rdn['cn']
    returns a list comprised of an `AVA` object with the value CN=www.redhat.com
rdn['2.5.4.3']
    returns a list comprised of an `AVA` object with the value CN=www.redhat.com
    because 2.5.4.3 is the dotted-decimal OID for common name (i.e. cn)
rdn.has_key('cn')
    returns True because the RDN has a common name RDN
rdn.has_key('2.5.4.3')
    returns True because the RDN has a common name AVA
    because 2.5.4.3 is the dotted-decimal OID for common name (i.e. cn)
len(rdn)
   returns 1 because there is one `AVA` object in it
list(rdn)
   returns a list of each `AVA` object in it
Instance Methods [hide private]
 
__contains__(x, y)
y in x
 
__eq__(x, y)
x==y
 
__ge__(x, y)
x>=y
 
__getitem__(x, y)
x[y]
 
__gt__(x, y)
x>y
 
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__le__(x, y)
x<=y
 
__len__(x)
len(x)
 
__lt__(x, y)
x<y
 
__ne__(x, y)
x!=y
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__repr__(x)
repr(x)
bool
has_key(arg)
return True if RDN has an AVA whose oid can be identified by arg.
Method Details [hide private]

__init__(...)
(Constructor)

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

__new__(T, S, ...)

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

__repr__(x)
(Representation operator)

 
repr(x)
Overrides: object.__repr__

has_key(arg)

 
return True if RDN has an AVA whose oid can be identified by arg.
Parameters:
  • arg (string or integer) - canonical name (e.g. 'cn') or oid dotted-decimal or SEC_OID_* enumeration constant
Returns: bool