1.2.1.4. validation¶
This module provides the functionality to perform context-sensitive validation of database models.
1.2.1.4.1. Functions¶
-
validate_credential(credential, campaign)[source]¶ Validate a credential object with regards to the configuration provided in campaign. This uses
validate_credential_fields()to validate each field individually and then return eitherNone,TrueorFalse. If no validation took place on any field,Noneis returned, otherwise if any field was validated then a boolean is returned indicating whether or not all validated (non-None) fields passed validation.Parameters: - credential – The credential object to validate.
- campaign – The campaign with the validation configuration.
Returns: Either a boolean or
Nonedepending on the results.
-
validate_credential_fields(credential, campaign)[source]¶ Validate a credential object with regards to the configuration provided in campaign. Each field in the credential object is validated and a new
CredentialCollectionis returned with it’s fields set to the results of the validation. A fields validation results are eitherNone,TrueorFalse. If no validation took place on the field, either because nothing was configured for it in campaign,or the validation information was invalid (a malformed regex for example) the result will beNone. Otherwise, the result is eitherTrueorFalsefor the field depending on the validation.Parameters: - credential – The credential object to validate.
- campaign – The campaign with the validation configuration.
Returns: A
CredentialCollectionobject with the fields set to the results of their respective validation.Return type: