Пример #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)