CMS 3D CMS Logo

Public Member Functions

betterConfigParser::AdaptedDict Class Reference

List of all members.

Public Member Functions

def __setitem__
def getSep

Detailed Description

Dictionary which handles updates of values for already existing keys
in a modified way.
Instead of replacing the old value, the new value is appended to the
value string separated by `self.getSep()`.
This dictionary is used in the class `BetterConfigParser` instead of the
default `dict_type` of the `ConfigParser` class.

Definition at line 7 of file betterConfigParser.py.


Member Function Documentation

def betterConfigParser::AdaptedDict::__setitem__ (   self,
  key,
  value,
  dict_setitem = dict.__setitem__ 
)
od.__setitem__(i, y) <==> od[i]=y
Updating an existing key appends the new value to the old value
separated by `self.getSep()` instead of replacing it.

Arguments:
- `key`: key part of the key-value pair
- `value`: value part of the key-value pair
- `dict_item`: method which is used for finally setting the item

Definition at line 24 of file betterConfigParser.py.

00025                                                                     :
00026         """
00027         od.__setitem__(i, y) <==> od[i]=y
00028         Updating an existing key appends the new value to the old value
00029         separated by `self.getSep()` instead of replacing it.
00030 
00031         Arguments:
00032         - `key`: key part of the key-value pair
00033         - `value`: value part of the key-value pair
00034         - `dict_item`: method which is used for finally setting the item
00035         """
00036 
00037         if "__name__" in self and self["__name__"]=="validation" \
00038                 and key in self and value!=self[key][0]:
00039             the_value = [self[key][0]+self.getSep()+value[0]]
00040         else:
00041             the_value = value
00042         dict_setitem(self, key, the_value)
00043 

def betterConfigParser::AdaptedDict::getSep (   self)
This method returns the separator used to separate the values for 
duplicate options in a config.

Definition at line 17 of file betterConfigParser.py.

00018                     :
00019         """
00020         This method returns the separator used to separate the values for 
00021         duplicate options in a config.
00022         """
00023         return " |/| "