Package turbogears :: Module validators :: Class Schema

Class Schema

source code

                        object --+                
                                 |                
formencode.declarative.Declarative --+            
                                     |            
              formencode.api.Validator --+        
                                         |        
             formencode.api.FancyValidator --+    
                                             |    
                      formencode.schema.Schema --+
                                                 |
                                                Schema

Modified Schema validator for TurboGears.

    A schema validates a dictionary of values, applying different validators
    (by key) to the different values.

    This modified Schema allows fields that do not appear in the fields
    parameter of your schema, but filters them out from the value dictionary.
    You might want to set filter_extra_fields to True when you're building a
    dynamic form with unpredictable keys and need these values.

**Messages**

``badDictType``:
  The input must be dict-like (not a ``%(type)s``: ``%(value)r``)

``badType``:
  The input must be a string (not a ``%(type)s``: ``%(value)r``)

``empty``:
  Please enter a value

``missingValue``:
  Missing value

``noneType``:
  The input must be a string (not None)

``notExpected``:
  The input field ``%(name)s`` was not expected.

``singleValueExpected``:
  Please provide only one value

Nested Classes

Inherited from formencode.api.FancyValidator: if_empty, if_invalid, if_invalid_python

Inherited from formencode.api.Validator: if_missing

Inherited from formencode.declarative.Declarative: __metaclass__

Instance Methods
 
from_python(self, value, state=None)
For Declarative subclasses, this decorator will call the method on the cls.singleton() object if called as a class method (or as normal if called as an instance method).

Inherited from formencode.schema.Schema: __initargs__, add_chained_validator, add_field, add_pre_validator, assert_dict, empty_value, is_empty, subvalidators

Inherited from formencode.api.FancyValidator: assert_string, base64encode, to_python, validate_other, validate_python

Inherited from formencode.api.Validator: __init__, all_messages, message

Inherited from formencode.declarative.Declarative: __call__, __repr__, __sourcerepr__

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

Class Methods

Inherited from formencode.declarative.Declarative: __classsourcerepr__, singleton

Static Methods

Inherited from formencode.schema.Schema: __classinit__

Class Variables
  filter_extra_fields = True
hash(x)
  allow_extra_fields = True
hash(x)
  if_key_missing = None
hash(x)
  declarative_count = 70

Inherited from formencode.schema.Schema: __mutableattributes__, accept_iterator, chained_validators, compound, fields, ignore_key_missing, messages, order, pre_validators

Inherited from formencode.api.FancyValidator: accept_python, not_empty, strip

Inherited from formencode.api.Validator: __singletonmethods__, gettextargs, repeating, use_builtins_gettext

Inherited from formencode.declarative.Declarative: __unpackargs__, counter

Properties

Inherited from object: __class__

Method Details

from_python(self, value, state=None)

 

For Declarative subclasses, this decorator will call the method on the cls.singleton() object if called as a class method (or as normal if called as an instance method).

Overrides: formencode.api.Validator.from_python