()
return {'status': 'ok'}
update db with user's comment & uid
update db with user's comment & uid
update db with user s comment & uid
def do_comment():
    """ update db with user's comment & uid """
    try:
        pid = long(request.values.get('pid'))
        uid = request.values.get('uid')
        comment = request.values.get('cmt')
    except Exception:
        return {'status': 'error',
                'reason': 'invalid request'}

    db = get_mongo('paper')
    db.update({'_id': pid}, {'$push': {'comments': {'cmt': comment, 'uid': uid}}})
    db.update({'_id': pid}, {'$inc': {'cmt_count': 1}})
    log_info("Add {0}'s comment to pdf {1}".format(uid, pid))

    return {'status': 'ok'}
def do_comment ( ) : try : pid = long ( request . values . get ( 'pid' ) ) uid = request . values . get ( 'uid' ) comment = request . values . get ( 'cmt' ) except Exception : return { 'status' : 'error' , 'reason' : 'invalid request' } db = get_mongo ( 'paper' ) db . update ( { '_id' : pid } , { '$push' : { 'comments' : { 'cmt' : comment , 'uid' : uid } } } ) db . update ( { '_id' : pid } , { '$inc' : { 'cmt_count' : 1 } } ) log_info ( "Add {0}'s comment to pdf {1}" . format ( uid , pid ) ) return { 'status' : 'ok' }