Package muntjac :: Package data :: Package validators :: Module null_validator :: Class NullValidator
[hide private]
[frames] | no frames]

Class NullValidator

source code

          object --+    
                   |    
validator.IValidator --+
                       |
                      NullValidator

This validator is used for validating properties that do or do not allow null values. By default, nulls are not allowed.


Authors:
Vaadin Ltd., Richard Lincoln

Version: 1.1.2

Instance Methods [hide private]
 
__init__(self, errorMessage, onlyNullAllowed)
Creates a new NullValidator.
source code
 
validate(self, value)
Validates the data given in value.
source code
 
isValid(self, value)
Tests if the given value is valid.
source code
 
isNullAllowed(self)
Returns True if nulls are allowed otherwise False.
source code
 
setNullAllowed(self, onlyNullAllowed)
Sets if nulls (and only nulls) are to be allowed.
source code
 
getErrorMessage(self)
Gets the error message that is displayed in case the value is invalid.
source code
 
setErrorMessage(self, errorMessage)
Sets the error message to be displayed on invalid value.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, errorMessage, onlyNullAllowed)
(Constructor)

source code 

Creates a new NullValidator.

Parameters:
  • errorMessage - the error message to display on invalidation.
  • onlyNullAllowed - Are only nulls allowed?
Overrides: object.__init__

validate(self, value)

source code 

Validates the data given in value.

Parameters:
  • value - the value to validate.
Raises:
Overrides: validator.IValidator.validate

isValid(self, value)

source code 

Tests if the given value is valid.

Parameters:
  • value - the value to validate.
Returns:
True for valid value, otherwise False.
Overrides: validator.IValidator.isValid

setNullAllowed(self, onlyNullAllowed)

source code 

Sets if nulls (and only nulls) are to be allowed.

Parameters:
  • onlyNullAllowed - If true, only nulls are allowed. If false only non-nulls are allowed. Do we allow nulls?

getErrorMessage(self)

source code 

Gets the error message that is displayed in case the value is invalid.

Returns:
the Error Message.

setErrorMessage(self, errorMessage)

source code 

Sets the error message to be displayed on invalid value.

Parameters:
  • errorMessage - the Error Message to set.