예제 #1
0
def update_apps():

    user_app = UserApp()
    try:
        user_id = current_user.get_id()
        apps_json_str = request.form["apps"]
        apps_json = json.loads(apps_json_str)
        result = user_app.set(user_id, apps_json )

    except Exception as e:
        print e
        raise ExceptionResponse("Bad json", 400)

    try:
        if result:
            response = {}
            response['data'] = result
            return jsonify(response)

        else:
            return  "lol no data"

    except psycopg2.DatabaseError as e:
        print e
        raise ExceptionResponse()
    
    except Exception as e:
        print e
        raise ExceptionResponse()
예제 #2
0
def get_apps():

    user_app = UserApp()
    try:
        user_id = current_user.get_id()
        apps = user_app.get(user_id)

        if apps:
            response = {}
            response['user'] = current_user.serialize()
            response['apps'] = apps
            return jsonify(response)


    except Exception as e:
        print e
        raise ExceptionResponse() 
예제 #3
0
파일: test.py 프로젝트: raghothams/appsync
def test_get_apps():
    app_mapper = UserApp()
    apps = app_mapper.get(1)
    print apps
예제 #4
0
파일: test.py 프로젝트: raghothams/appsync
def test_update_apps():
    app_mapper = UserApp()
    res = app_mapper.set(1, '{"attr":"loler"}')
    print res