relief.validation

class relief.validation.Present

Validator that fails with message if the value is unspecified.

message = u'May not be blank.'

Message that is stored in Element.errors.

class relief.validation.Converted

Validator that fails with message if the value is not unserializable.

message = u'Not a valid value.'

Message that is stored in Element.errors.

class relief.validation.IsTrue

Validator that fails with message if the value is false-ish.

message = u'Must be true.'

Message that is stored in Element.errors.

class relief.validation.IsFalse

Validator that fails with message if the value is true-ish.

message = u'Must be false.'

Message that is stored in Element.errors.

class relief.validation.ShorterThan(upperbound)

Validator that fails with message if the length of the value is equal to or longer than the given upperbound.

message = u'Must be shorter than {upperbound}.'

Message that is stored in Element.errors. {upperbound} in the message is substituted with the given upperbound.

class relief.validation.LongerThan(lowerbound)

Validator that fails with message if the length of the value is equal to or shorter than the given lowerbound.

message = u'Must be longer than {lowerbound}.'

Message that is stored in Element.errors. {lowerbound} in the message is substituted with the given lowerbound.

class relief.validation.LengthWithinRange(start, end)

Validator that fails with message if the length of the value is less than or equal to start or greater than or equal to end.

message = u'Must be longer than {start} and shorter than {end}.'

Message that is stored in Element.errors. {start} and {end} is substituted with the given start and end.

class relief.validation.ContainedIn(options)

A validator that fails with "Not a valid value." if the value is not contained in options.

message = u'Not a valid value.'

Message that is stored in Element.errors.

class relief.validation.LessThan(upperbound)

Validator that fails with message if the value is greater than or equal to upperbound.

message = u'Must be less than {upperbound}.'

Message that is stored in Element.errors. {upperbound} is substituted with the given upperbound.

class relief.validation.GreaterThan(lowerbound)

Validator that fails with message if the value is less than or equal to lowerbound.

message = u'Must be greater than {lowerbound}.'

Message that is stored in the Element.errors. {lowerbound} is substituted with the given lowerbound.

class relief.validation.WithinRange(start, end)

Validator that fails with message if the value is less than or equal to start or greater than or equal to end.

message = u'Must be greater than {start} and shorter than {end}.'

Message that is stored in Element.errors. {start} and {end} are substituted with the given start and end.

class relief.validation.ItemsEqual(a, b)

Validator that fails with message if two items in the value are unequal.

The items are defined with the tuples a and b each of which consist of two elements (label, key). The key is used to determine the item to compare and the label is used for substitution in the message.

message = u'{a} and {b} must be equal.'

Message that is stored in Element.errors. {a} and {b} are substituted with the labels in the given a and b.

class relief.validation.AttributesEqual(a, b)

Validator that fails with message if two attributes of the value are unequal.

Similar to ItemsEqual the attributes are defined with the tuples a and b each of which consists of two element in the form (label, attribute_name). attribute_name is used to determine the attributes to compare and the label is used for substitution in the message.

message = u'{a} and {b} must be equal.'

Message that is stored in Element.errors. {a} and {b} are substituted with the labels in the given a and b.

class relief.validation.ProbablyAnEmailAddress

A validator that fails with message, if the value of the validated e-mail is not a valid e-mail address.

While this validator works on valid e-mail addresses it is not expected to pick up all bad e-mail addresses. The reason for this is that parsing e-mail addresses is very complicated, costly, probably would wrongly recognize some valid e-mail addresses as invalid and cannot determine if someone is reachable with this address.

If you want to truly validate e-mail addresses you need to send an e-mail and wait for a response.

message = u'Must be a valid e-mail address.'

Message that is stored in the Element.errors.

Project Versions

Previous topic

relief

Next topic

Contributing

This Page