VirtualMailManager/Config.py
branchv0.6.x
changeset 201 dbb0f7ed7858
parent 200 983cf98d5881
child 204 83938336c518
equal deleted inserted replaced
200:983cf98d5881 201:dbb0f7ed7858
   245         ``validate`` : NoneType or a callable
   245         ``validate`` : NoneType or a callable
   246             None or any method, that takes one argument, in order to check
   246             None or any method, that takes one argument, in order to check
   247             the value, when `LazyConfig.set()` is called.
   247             the value, when `LazyConfig.set()` is called.
   248         """
   248         """
   249         self.__cls = cls
   249         self.__cls = cls
   250         self.__default = default
   250         if not default is None:# enforce the type of the default value
       
   251             self.__default = self.__cls(default)
       
   252         else:
       
   253             self.__default = default
   251         if not callable(getter):
   254         if not callable(getter):
   252             raise TypeError('getter has to be a callable, got a %r' %
   255             raise TypeError('getter has to be a callable, got a %r' %
   253                             getter.__class__.__name__)
   256                             getter.__class__.__name__)
   254         self.__getter = getter
   257         self.__getter = getter
   255         if validate and not callable(validate):
   258         if validate and not callable(validate):