예제 #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
파일: users.py 프로젝트: ilyaguy/point-www
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
파일: users.py 프로젝트: radjah/point-xmpp
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)