Esempio n. 1
0
def unsubscribe_thread(thread_id):
    try:
        g.user.username
    except AttributeError:
        abort(401)
    if request.method == "POST":
        t = Thread(redis=g.r, user=g.user)
        t.load(thread_id)
        t.unsubscribe()
        flash(u'Unsubscribed from thread.', 'success')
        return redirect(url_for('frontend.inbox'))
    else:
        return render_template('confirm.html',
            _message='Are you sure you wish to unsubscribe from this thread?',
            _ok=url_for('frontend.unsubscribe_thread', thread_id=thread_id),
            _cancel=url_for('frontend.inbox')
        )
Esempio n. 2
0
def unsubscribe_thread(thread_id):
    try:
        g.user.username
    except AttributeError:
        abort(401)
    if request.method == "POST":
        t = Thread(redis=g.r, user=g.user)
        t.load(thread_id)
        t.unsubscribe()
        flash(u'Unsubscribed from thread.', 'success')
        return redirect(url_for('frontend.inbox'))
    else:
        return render_template(
            'confirm.html',
            _message='Are you sure you wish to unsubscribe from this thread?',
            _ok=url_for('frontend.unsubscribe_thread', thread_id=thread_id),
            _cancel=url_for('frontend.inbox'))