示例#1
0
def add_to_blacklist():
    if not env.owner or not env.owner.id:
        raise NotFound

    try:
        res = users.add_to_blacklist(env.owner)
    except SubscribeError:
        raise Forbidden

    if env.request.is_xhr:
        return Response(json.dumps({"ok": bool(res)}), mimetype="application/json")

    return Response(redirect=env.request.referer)
示例#2
0
def add_to_blacklist():
    if not env.owner or not env.owner.id:
        raise NotFound

    try:
        res = users.add_to_blacklist(env.owner)
    except SubscribeError:
        raise Forbidden

    if env.request.is_xhr:
        return Response(json.dumps({'ok': bool(res)}),
                        mimetype='application/json')

    return Response(redirect=env.request.referer)
示例#3
0
def add_to_blacklist(logins):
    logins = re.split(r'[\s@,]+', logins.strip(' \t@'))

    added = []
    already = []
    not_found = []

    for login in logins:
        try:
            if users.add_to_blacklist(login):
                added.append(login)
            else:
                already.append(login)
        except SubscribeError:
            pass
        except UserNotFound:
            not_found.append(login)

    return xmpp_template('bl_updated', added=added, already=already,
                                       not_found=not_found)
示例#4
0
def add_to_blacklist(logins):
    logins = re.split(r'[\s@,]+', logins.strip(' \t@'))

    added = []
    already = []
    not_found = []

    for login in logins:
        try:
            if users.add_to_blacklist(login):
                added.append(login)
            else:
                already.append(login)
        except SubscribeError:
            pass
        except UserNotFound:
            not_found.append(login)

    return xmpp_template('bl_updated',
                         added=added,
                         already=already,
                         not_found=not_found)
示例#5
0
def add_to_blacklist(login):
    users.add_to_blacklist(login)
示例#6
0
def add_to_blacklist(login):
    users.add_to_blacklist(login)