def json_out(content_type='application/json', debug=False, handler=json_handler):
 request = cherrypy.serving.request
 if (request.handler is None):
  return
 if debug:
  cherrypy.log(('Replacing %s with JSON handler' % request.handler), 'TOOLS.JSON_OUT')
 request._json_inner_handler = request.handler
 request.handler = handler
 if (content_type is not None):
  if debug:
   cherrypy.log(('Setting Content-Type to %s' % content_type), 'TOOLS.JSON_OUT')
  cherrypy.serving.response.headers['Content-Type'] = content_type

def json_out ( content_type = 'application/json' , debug = False , handler = json_handler ) : request = cherrypy . serving . request if ( request . handler is None ) : return if debug : cherrypy . log ( ( 'Replacing %s with JSON handler' % request . handler ) , 'TOOLS.JSON_OUT' ) request . _json_inner_handler = request . handler request . handler = handler if ( content_type is not None ) : if debug : cherrypy . log ( ( 'Setting Content-Type to %s' % content_type ) , 'TOOLS.JSON_OUT' ) cherrypy . serving . response . headers [ 'Content-Type' ] = content_type
wrap request .