web_socket.py 文件源码

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

项目:jatumba-backend 作者: YetAnotherTeam 项目源码 文件源码
def history(self, request, data, error_message, filter_lookup, order_function, *args, **kwargs):
        user_id = request.channel_session.get('user')
        if user_id is not None:
            composition_id = int(kwargs.get('composition_id'))
            serializer = DiffHistorySerializer(
                data=data,
                context={'composition_id': composition_id}
            )
            serializer.is_valid(raise_exception=True)
            diff_version_id = serializer.data['diff_composition_version']
            diff_version = getattr(DiffCompositionVersion.objects
                                   .filter(
                                        composition_id=composition_id,
                                        **{filter_lookup: diff_version_id}
                                    ), order_function)()
            if diff_version is None:
                raise NotFound(error_message)
            self.route_send(
                request.reply_channel,
                DiffCompositionVersionSerializer(diff_version).data,
                status.HTTP_200_OK
            )
        else:
            raise PermissionDenied
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号