Ejemplo n.º 1
0
def note_save():
    try:
        note = mymodel.formtomodel(request.form, Note)
        bo = PaperSvc().note_save(note)
        if not bo:
            return jsonify_response(apicode.ERROR)
        return jsonify_response(apicode.OK)
    except Exception as e:
        logger.exception(e)
        return jsonify_response(apicode.ERROR)
Ejemplo n.º 2
0
def essay_save():
    try:
        essay = mymodel.formtomodel(request.form, Essay)
        bo = PaperSvc().essay_save(essay)
        if not bo:
            return jsonify_response(apicode.ERROR)
        return jsonify_response(apicode.OK)
    except Exception as e:
        logger.exception(e)
        return jsonify_response(apicode.ERROR)
Ejemplo n.º 3
0
def album_save():
    try:
        album = mymodel.formtomodel(request.form, Album)
        bo = PaperSvc().album_save(album)
        if not bo:
            return jsonify_response(apicode.ERROR)
        return jsonify_response(apicode.ERROR)
    except Exception as e:
        logger.exception(e)
        return jsonify_response(apicode.ERROR)
Ejemplo n.º 4
0
def usergroup_save():
    try:
        usergroup = mymodel.formtomodel(request.form, UserGroup)
        bo = GroupSvc().usergroup_save(usergroup)
        if not bo:
            return jsonify_response(apicode.ERROR)
        return common_json_response()
    except Exception as e:
        logger.exception(e)
        return jsonify_response(apicode.ERROR)
Ejemplo n.º 5
0
def paper_save():
    try:
        paper = mymodel.formtomodel(request.form, Paper)
        paper = PaperSvc().paper_save(paper)
        if paper:
            return common_json_response(paper=paper)
        else:
            return jsonify_response(apicode.ERROR)
    except Exception as e:
        logger.exception(e)
        return jsonify_response(apicode.ERROR)
Ejemplo n.º 6
0
def book_save():
    try:
        book = mymodel.formtomodel(request.form, Book)
        bo = PaperSvc().book_save(book)
        if bo:
            return jsonify_response(apicode.OK)
        else:
            return jsonify_response(apicode.ERROR)
    except Exception as e:
        logger.exception(e)
        return jsonify_response(apicode.ERROR)
Ejemplo n.º 7
0
def photo_save():
    try:
        data = request.form
        photo = mymodel.formtomodel(data, Photo)
        key = data['path']
        file = File()
        file.path = key
        file.type = 'photo'
        file.name = photo.name
        fid = PaperSvc().file_save(file)
        if not fid:
            return jsonify_response(apicode.ERROR)
        photo.fid = fid
        bo = PaperSvc().photo_save(photo)
        if not bo:
            return jsonify_response(apicode.ERROR)
        return jsonify_response(apicode.OK)
    except Exception as e:
        logger.exception(e)
        return jsonify_response(apicode.ERROR)