Base class for all fixed types, implemented as descriptors. Each instance of a specific fixed type
(a derived class) can be set either to None (to indicate no value has been set), or to a type specified
by the derived class. The type is checked by the derived class by implementing the member function
_checkType()
Definition at line 10 of file TransformConfig.py.
def python.TransformConfig.Descriptor._checkType |
( |
|
self, |
|
|
|
variableName, |
|
|
|
value |
|
) |
| |
|
private |
Private helper functin to check the type of <value>. May convert to another type.
This implementation does nothing, it just returns value.
This function can be overridden in derived class to do type checking.
It should return the value (possible with new type), or raise a TransformConfigError
exception in case of problems.
Reimplemented in python.TransformConfig.ListOfStrings, and python.TransformConfig.UniqueList.
Definition at line 83 of file TransformConfig.py.
83 def _checkType(self,variableName,value):
84 """Private helper functin to check the type of <value>. May convert to another type.
85 This implementation does nothing, it just returns value.
86 This function can be overridden in derived class to do type checking.
87 It should return the value (possible with new type), or raise a TransformConfigError
88 exception in case of problems. """
def python.TransformConfig.Descriptor._checkValue |
( |
|
self, |
|
|
|
variableName, |
|
|
|
value |
|
) |
| |
|
private |
Private helper function to check the value of <value>. This function is
called after calling _checkType. <value> can therefore be considered to be
of the correct type.
This implementation checks that the value is one of the allowed values (if defined).
This function can be overridden in derived class to do type & additional value checking.
It has to return the value (adapted if needed) if all is OK. It has to raise
a TransformConfigError exception in case of problems.
<variableName> is the name of the variable that is being set and is typically
only used for error messages.
Reimplemented in python.TransformConfig.UniqueList, python.TransformConfig.Integer, python.TransformConfig.Float, and python.TransformConfig.String.
Definition at line 92 of file TransformConfig.py.
92 def _checkValue(self,variableName,value):
93 """Private helper function to check the value of <value>. This function is
94 called after calling _checkType. <value> can therefore be considered to be
96 This implementation checks that the value is one of the allowed values (if defined).
97 This function can be overridden in derived class to do type & additional value checking.
98 It has to return the value (adapted if needed) if all is OK. It has to raise
99 a TransformConfigError exception in case of problems.
100 <variableName> is the name of the variable that is being set and is typically
101 only used for error messages."""
102 if self.__allowed
and value
not in self.__allowed:
103 raise TransformConfigError(
'%s value %r is not in %s' %
104 (variableName, value, self.__allowed) )
def python.TransformConfig.Descriptor._setValue |
( |
|
self, |
|
|
|
variableName, |
|
|
|
value |
|
) |
| |
|
private |
Private helper function which is called when the value of the object is set.
It is called after _checkType() and _checkValue(), so the value can be
assumed to be correct.
This function can be overridden in a derived class, typically to trigger additional action
when the value is set.
In case of error, raise a TransformConfigError exception, otherwise just return.
This implementation does nothing.
<variableName> is the name of the variable that is being set and is typically
only used for error messages.
Definition at line 109 of file TransformConfig.py.
109 def _setValue(self,variableName,value):
110 """Private helper function which is called when the value of the object is set.
111 It is called after _checkType() and _checkValue(), so the value can be
112 assumed to be correct.
113 This function can be overridden in a derived class, typically to trigger additional action
114 when the value is set.
115 In case of error, raise a TransformConfigError exception, otherwise just return.
116 This implementation does nothing.
117 <variableName> is the name of the variable that is being set and is typically
118 only used for error messages."""