Beispiel #1
0
def comment_add():
    j = request.get_json()
    c = Comment(j)
    log('comment request.get_json():', j)
    c.user = current_user()
    c.save()
    comment = c.comment_row()
    log('新增Comment:', c)
    log('comment add, dict: ', comment)
    t = comment.get('time', '')
    ft = from_now(t)
    response_data = {
        'id': comment.get('id', ''),
        'user_link': comment.get('user_link', ''),
        'time': ft,
        'content': comment.get('content', ''),
    }
    return json.dumps(response_data, indent=2)