示例#1
0
文件: notes.py 项目: slysid/Notewall
def postNewNote():
    
    authorization = canRespondToRequest()
    
    if authorization[0] == True:
    
        if (request.headers['Content-Type'] == 'application/json'):
    
            response, postdata, ownerid = validatePostParam()
            logger = logging.getLogger(__name__)
            generalLogging(logger)
    
            if response != None:
                return jsonify(response)
    
            data = noteQueries.postNewNote(postdata)
            return jsonify(data)
        elif ('multipart/form-data' in request.headers['Content-Type']):
            return postImage(authorization[1])
        else:
            return jsonify({"warn":"No operation performed"})
        
    else:
        
        return jsonify({'data':{'error' : authorization[1]}})
示例#2
0
文件: notes.py 项目: slysid/Notewall
def allnotes():
    
    authorization = canRespondToRequest()
    
    if authorization[0] == True:
        response, postdata, ownerid = validatePostParam(request.json)
        logger = logging.getLogger(__name__)
        generalLogging(logger)
    
        if response != None:
            return jsonify(response)
    
        data = noteQueries.getAllNotes(ownerid)
        return jsonify(data)
    
    else:
        
        return jsonify({'data':{'error' : authorization[1]}})