def __prepare_json_ret(request, ret, callback_param_name=None, use_iframe=False):
    if ret==False:
        ret = {'success':False}
    elif ret==None: # Sometimes there is no return.
        ret = {}
    # Add the 'ret'=True, since it was obviously no set yet and we got valid data, no exception.
    func_name = None
    if callback_param_name:
        func_name = request.GET.get(callback_param_name, "callbackParamName")
    try:
        if not ret.has_key('success'):
            ret['success'] = True
    except __HOLE__, e:
        raise Exception("The returned data of your function must be a dictionary!")
    json_ret = ""
    try:
        # Sometimes the serialization fails, i.e. when there are too deeply nested objects or even classes inside
        json_ret = to_json_response(ret, func_name, use_iframe)
    except Exception, e:
        print '\n\n===============Exception=============\n\n'+str(e)+'\n\n' 
        print ret
        print '\n\n'
        return HttpResponseServerError(content=str(e))
    return json_ret
dataset/ETHPy150Open klipstein/dojango/dojango/decorators.py/__prepare_json_ret