comments.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:henet 作者: AcrDijon 项目源码 文件源码
def new_comment():
    data = request.json
    comments_dir = app._config['henet']['comments_dir']
    article_uuid = data['source_path']
    article_thread = ArticleThread(comments_dir, article_uuid)
    article_thread.add_comment(text=data['text'],
                               author=data['author'])

    article_thread.save()
    notifs = app._config['notifications']
    moderator = notifs.get('moderate_comment')
    if moderator is not None:
        app.send_email([moderator], u'Nouveau commentaire',
                       MODERATE_BODY)

    emit(EVENT_CREATED_COMMENT, article_uuid=article_uuid)
    return {'result': 'OK'}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号