#NEWLINE# def form_to_params( fn = None , return_json = True ) : #NEWLINE# #INDENT# '\n    Convert bottle forms request to parameters for the wrapped function.\n\n    Args:\n        return_json (bool, default True): Should the decorator automatically\n                    convert returned value to JSON?\n    ' #NEWLINE# def forms_to_params_decorator( fn ) : #NEWLINE# #INDENT# @ handle_type_error #NEWLINE# @ wraps ( fn ) #NEWLINE# def forms_to_params_wrapper( * args , **kwargs ) : #NEWLINE# #INDENT# kwargs . update ( dict ( request . forms ) ) #NEWLINE# if ( not return_json ) : #NEWLINE# #INDENT# return fn ( * args , ** kwargs ) #NEWLINE# #UNINDENT# return encode_json_body ( fn ( * args , ** kwargs ) ) #NEWLINE# #UNINDENT# return forms_to_params_wrapper #NEWLINE# #UNINDENT# if fn : #NEWLINE# #INDENT# return forms_to_params_decorator ( fn ) #NEWLINE# #UNINDENT# return forms_to_params_decorator