VirtualMailManager/config.py
branchv0.7.x
changeset 638 0de0b9e75c9f
parent 611 8e9b0046bc8f
child 641 724ac0a4068d
equal deleted inserted replaced
637:ca6621caff2f 638:0de0b9e75c9f
   244         `validate` : NoneType or a callable
   244         `validate` : NoneType or a callable
   245           None or any method, that takes one argument, in order to
   245           None or any method, that takes one argument, in order to
   246           check the value, when `LazyConfig.set()` is called.
   246           check the value, when `LazyConfig.set()` is called.
   247         """
   247         """
   248         self.__cls = cls
   248         self.__cls = cls
   249         if not default is None:  # enforce the type of the default value
   249         self.__default = default if default is None else self.__cls(default)
   250             self.__default = self.__cls(default)
       
   251         else:
       
   252             self.__default = default
       
   253         if not callable(getter):
   250         if not callable(getter):
   254             raise TypeError('getter has to be a callable, got a %r' %
   251             raise TypeError('getter has to be a callable, got a %r' %
   255                             getter.__class__.__name__)
   252                             getter.__class__.__name__)
   256         self.__getter = getter
   253         self.__getter = getter
   257         if validate and not callable(validate):
   254         if validate and not callable(validate):