Package gluon :: Module validators :: Class IS_JSON
[hide private]
[frames] | no frames]

Class IS_JSON

source code

object --+    
         |    
 Validator --+
             |
            IS_JSON

example:

   INPUT(_type='text', _name='name',
       requires=IS_JSON(error_message="This is not a valid json input")

   >>> IS_JSON()('{"a": 100}')
   ({u'a': 100}, None)

   >>> IS_JSON()('spam1234')
   ('spam1234', 'invalid json')
Instance Methods [hide private]
 
__init__(self, error_message='Invalid json', native_json=False)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__call__(self, value) source code
 
formatter(self, value)
For some validators returns a formatted version (matching the validator) of 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, error_message='Invalid json', native_json=False)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__call__(self, value)
(Call operator)

source code 
Overrides: Validator.__call__

formatter(self, value)

source code 

For some validators returns a formatted version (matching the validator) of value. Otherwise just returns the value.

Overrides: Validator.formatter
(inherited documentation)