Gnumed.pycommon.gmConfigCommon.ConfigSource

Package Gnumed :: Package pycommon :: Module gmConfigCommon :: Class ConfigSource |
[frames] | no frames]

# Class ConfigSource

source code

Base class for interface to access config data and definitions on a single configuration source (config file, user/workplace specific backend data collection. The source name will be used to retrieve the config definitions from a config definition source (file, DB) automatically.

Instance Methods
__init__(self, aSourceType=None, aSourceName=None, aDataSource=None) | source code
getParamType(self, aParam=None) get type of parameter value | source code
castType(self, aParam=None, aValue=None) cast type of entered parameter value to the previously existing type. | source code
getDescription(self, aParam=None) Get parameter description either from config definition or from config data | source code
getAllParamNames(self) Get all parameter names from backend or a file. | source code
setConfigData(self, aParam, aValue) Set config data for a aParam to aValue. | source code
getConfigData(self, aParam) Get config data for a aParam. | source code
addConfigParam(self, aParam, aType, aValue, aDescription) Adds config new config parameter. | source code
getRawName(self, aParam) Get config data for a aParam. | source code
hasDefinition(self) return true if config definition object is available | source code
hasParameterDefinition(self, aParam) Returns true if config definition is available for this parameter. | source code
isValid(self, aParam, aValue) Returns true if aValue matches config definition for this parameter. | source code

Method Details

### getAllParamNames(self) | source code
    Get all parameter names from backend or a file.
    Returns dict of names + metadata.
    format:
    dict {'name1': [namepart_2,namepart_1,owner,type,description],
           'name2': [option,group,owner,type,description],...}
    usually the full name is a composition of namepart_1 +_2,
    but don't rely on the order - it depends on whether you get
    data from DB or file. type is the type as found in the data
    (one of 'string', 'string_arr' or 'numeric'). description is the
    description supplied with the data, not the one given in the
    parameter definition file ! Use getDescription() to get the right
    one.