@RequireLogin()
def delete(request, rule_id):
    """
    Delete rule based on rule_id.
    """
    dbc = db_model.connect()
    try:
        rule = dbc.rule.find_one({'_id': ObjectId(rule_id)})
    except InvalidId:
        return HttpResponseNotFound()
    if rule is None:
        return HttpResponseNotFound()
    else:
        dbc.rule.remove({"_id": ObjectId(rule_id)})
        logger.info("rule '%s' deleted by '%s'" % (rule_id, request.user['username']))
        return HttpResponse()
dataset/ETHPy150Open emccode/heliosburn/heliosburn/django/hbproject/api/views/rule.py/delete/original