document.py 文件源码

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

项目:Young 作者: shiyanhui 项目源码 文件源码
def get_comment_list(share_id, skip=0, limit=None):
        cursor = ShareCommentDocument.find({
            'share': DBRef(
                ShareDocument.meta['collection'],
                ObjectId(share_id)
            )
        }).sort([('comment_time', pymongo.ASCENDING)]).skip(skip)

        if limit is not None:
            cursor = cursor.limit(limit)

        comment_list = yield ShareCommentDocument.to_list(cursor)

        for i, comment in enumerate(comment_list):
            comment['floor'] = skip + 1 + i
            comment['author'] = yield UserDocument.translate_dbref(
                comment['author']
            )
            if 'replyeder' in comment:
                comment['replyeder'] = yield UserDocument.translate_dbref(
                    comment['replyeder']
                )

        raise gen.Return(comment_list)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号