ReportItemsController.py 文件源码

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

项目:cerberus-core 作者: ovh 项目源码 文件源码
def unblock_item(item_id, report_id=None, ticket_id=None):
    """
        Unblock given `abuse.models.ReportItem`
    """
    try:
        item = ReportItem.objects.get(id=item_id)
        if report_id:
            report = Report.objects.get(id=report_id)
            if item.report.id != report.id:
                raise BadRequest('Given item not attached to given report')
        if ticket_id:
            ticket = Ticket.objects.get(id=ticket_id)
            if item.report.id not in ticket.reportTicket.all().values_list('id', flat=True):
                raise BadRequest('Given item not attached to given ticket')
    except (AttributeError, ObjectDoesNotExist, TypeError, ValueError):
        raise NotFound('Item not found')

    utils.default_queue.enqueue(
        'phishing.unblock_url',
        url=item.rawItem,
    )
    return {'message': 'Unblocking job successfully scheduled'}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号