Example #1
0
def async_contact_search(part):
    try:
        g.user.username
    except AttributeError:
        abort(401)
    c = Contacts(redis=g.r, user=g.user)
    return json.dumps(c.search(part))
Example #2
0
def async_contact_search(part):
    try:
        g.user.username
    except AttributeError:
        abort(401)
    c = Contacts(redis=g.r, user=g.user)
    return json.dumps(c.search(part))
Example #3
0
def del_contact(contact, redirect_url=None):
    try:
        g.user.username
    except AttributeError:
        abort(401)
    c = Contacts(redis=g.r, user=g.user)
    c.delete(contact)
    t = g.user.timeline
    t.rebuild()
    flash('Deleted contact "%s".' % contact, 'success')
    if not redirect_url:
        redirect_url = url_for('frontend.contacts')
    return redirect(redirect_url)
Example #4
0
def del_contact(contact, redirect_url=None):
    try:
        g.user.username
    except AttributeError:
        abort(401)
    c = Contacts(redis=g.r, user=g.user)
    c.delete(contact)
    t = g.user.timeline
    t.rebuild()
    flash('Deleted contact "%s".' % contact, 'success')
    if not redirect_url:
        redirect_url = url_for('frontend.contacts')
    return redirect(redirect_url)
Example #5
0
def add_contact(contact, redirect_url=None):
    try:
        g.user.username
    except AttributeError:
        abort(401)
    try:
        c = Contacts(redis=g.r, user=g.user)
        c.add(contact)
        flash('Added user "%s" to address book.' % contact, 'success')
    except KeyError:
        flash('No user specified.', 'error')
    except ContactInvalidError:
        flash('User "%s" does not exist.' % contact, 'error')
    except ContactExistsError:
        flash('User "%s" is already in your address book.' % contact, 'error')

    t = g.user.timeline
    t.rebuild()
    if not redirect_url:
        redirect_url = url_for('frontend.contacts')
    return redirect(redirect_url)
Example #6
0
def add_contact(contact, redirect_url=None):
    try:
        g.user.username
    except AttributeError:
        abort(401)
    try:
        c = Contacts(redis=g.r, user=g.user)
        c.add(contact)
        flash('Added user "%s" to address book.' % contact, 'success')
    except KeyError:
        flash('No user specified.', 'error')
    except ContactInvalidError:
        flash('User "%s" does not exist.' % contact, 'error')
    except ContactExistsError:
        flash('User "%s" is already in your address book.' % contact, 'error')

    t = g.user.timeline
    t.rebuild()
    if not redirect_url:
        redirect_url = url_for('frontend.contacts')
    return redirect(redirect_url)