def rison(schema=None):
def _rison(f):<EOL><INDENT>def wraps(self, *args, **kwargs):<EOL><INDENT>value = request.args.get(API_URI_RIS_KEY, None)<EOL>kwargs["<STR_LIT>"] = dict()<EOL>if value:<EOL><INDENT>try:<EOL><INDENT>kwargs["<STR_LIT>"] = prison.loads(value)<EOL><DEDENT>except prison.decoder.ParserException:<EOL><INDENT>return self.response_400(message="<STR_LIT>")<EOL><DEDENT><DEDENT>if schema:<EOL><INDENT>try:<EOL><INDENT>jsonschema.validate(instance=kwargs["<STR_LIT>"], schema=schema)<EOL><DEDENT>except jsonschema.ValidationError as e:<EOL><INDENT>return self.response_400(<EOL>message="<STR_LIT>".format(e)<EOL>)<EOL><DEDENT><DEDENT>return f(self, *args, **kwargs)<EOL><DEDENT>return functools.update_wrapper(wraps, f)<EOL><DEDENT>return _rison<EOL>
Use this decorator to parse URI *Rison* arguments to
a python data structure, your method gets the data
structure on kwargs['rison']. Response is HTTP 400
if *Rison* is not correct::

    class ExampleApi(BaseApi):
            @expose('/risonjson')
            @rison()
            def rison_json(self, **kwargs):
                return self.response(200, result=kwargs['rison'])

You can additionally pass a JSON schema to
validate Rison arguments::

    schema = {
        "type": "object",
        "properties": {
            "arg1": {
                "type": "integer"
            }
        }
    }

    class ExampleApi(BaseApi):
            @expose('/risonjson')
            @rison(schema)
            def rison_json(self, **kwargs):
                return self.response(200, result=kwargs['rison'])