google.appengine.api.validation.Deprecated

A deprecated field.

Inherits From: Normalized, Validator, expected_type

For use with Preferred. Only works as a field on Validated.

Both fields will work for value access. It's an error to set both the deprecated and the corresponding preferred field.

preferred The name of the preferred field.
validator The validator for the actual value of this field.
default The default value for this field.

Child Classes

class expected_type

Methods

CheckFieldInitialized

View source

Check for missing fields or conflicts between fields.

Default behavior performs a simple None-check, but this can be overridden. If the intent is to allow optional fields, then use the Optional validator instead.

Args
value Value to validate.
key Name of the field being validated.
obj The object to validate against.

Raises
ValidationError When there are missing or conflicting fields.

Get

View source

Returns the normalized value. Subclasses must override.

GetWarnings

View source

Return any warnings on this attribute.

Validates the value with an eye towards things that aren't fatal problems.

Args
value Value to validate.
key Name of the field being validated.
obj The object to validate against.

Returns
A list of tuples (context, warning) where

  • Context is the field (or dotted field path, if a sub-field)
  • Warning is the string warning text

ToValue

View source

Convert value to a simplified collection or basic type.

Subclasses of Validator should override this method when the dumped representation of value is not a simple <type>(value) (e.g., a regex).

Args
value An object of the same type that was returned from Validate().

Returns
An instance of a builtin type (e.g., int, str, dict, etc). By default it returns value unmodified.

Validate

View source

Validate this field. Override to customize subclass behavior.

Args
value Value to validate.
key Name of the field being validated.

Returns
Value if value is valid, or a valid representation of value.

__call__

View source

Main interface to validator is call mechanism.