Package mrv :: Module conf :: Class Section
[hide private]
[frames] | no frames]

Class Section

source code

         object --+    
                  |    
_PropertyHolderBase --+
                      |
                     Section
Known Subclasses:

Class defininig an indivual section of a configuration file including all its keys and section properties

Note: name will be stored stripped and must not contain certain chars

Instance Methods [hide private]
 
__iter__(self)
Returns: key iterator
source code
 
__init__(self, name, order)
Basic Field Initialization
source code
 
__hash__(self)
hash(x)
source code
 
__eq__(self, other) source code
 
__str__(self)
Returns: section name
source code
 
_excPrependNameAndRaise(self) source code
 
_setName(self, name) source code
 
_getName(self) source code
 
mergeWith(self, othersection)
Merge our section with othersection
source code

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

    Key Access
 
key(self, name)
Returns: Key with name
source code
 
keyDefault(self, name, value)
Returns: tuple: 0 = Key with name, create it if required with given value, 1 = true if newly created, false otherwise
source code
 
setKey(self, name, value)
Set the value to key with name, or create a new key with name and value
source code
Class Variables [hide private]
  _re_checkName = re.compile(r'\+?\w+(:[\w\(\)]+)?')
Properties [hide private]
  _name
  keys

Inherited from _PropertyHolderBase: order, properties

Inherited from object: __class__

    Properties
  name
Method Details [hide private]

__iter__(self)

source code 
Returns:
key iterator

__init__(self, name, order)
(Constructor)

source code 
Basic Field Initialization
Parameters:
  • order - -1 = will be written to end of list, or to given position otherwise
Overrides: object.__init__

__hash__(self)
(Hashing function)

source code 

hash(x)

Overrides: object.__hash__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Returns:
section name
Overrides: object.__str__

_setName(self, name)

source code 
Raises:
  • ValueError - if name contains invalid chars

mergeWith(self, othersection)

source code 

Merge our section with othersection

:note:self will be altered

key(self, name)

source code 
Returns:
Key with name
Raises:
  • NoOptionError

keyDefault(self, name, value)

source code 
Parameters:
  • value - anything supported by setKey
Returns:
tuple: 0 = Key with name, create it if required with given value, 1 = true if newly created, false otherwise

setKey(self, name, value)

source code 
Set the value to key with name, or create a new key with name and value
Parameters:
  • value - int, long, float, string or list of any of such
Raises:
  • ValueError - if key has incorrect value

Property Details [hide private]

name

Get Method:
_getName(self)
Set Method:
_setName(self, name)