topics.py 文件源码

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

项目:GitDigger 作者: lc-soft 项目源码 文件源码
def post(self, name):
        if not current_user.is_authenticated:
            return abort(401, message='permission denied')
        for topic in current_user.following_topics:
            if topic.name == name:
                return topic
        topic = topics_service.get(name)
        if topic is None:
            return abort(400, message='topic not found')
        try:
            current_user.following_topics.append(topic)
            topic.followers_count += 1
            print topic.followers_count
            db.session.commit()
        except:
            db.session.rollback()
            return abort(500, message='operation failed')
        return topic
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号