示例#1
0
文件: account.py 项目: Gwill/zerqu
def delete_topic(token):
    key = 'account:delete-topic:%s' % token
    tid = redis.get(key)
    if not tid:
        abort(404)

    topic = Topic.query.get_or_404(int(tid))
    title = topic.title
    form = Form()
    show_message = False
    if form.validate_on_submit():
        with db.auto_commit():
            db.session.delete(topic)
        show_message = True
    return render_template(
        'account/delete-topic.html',
        title=title,
        form=form,
        show_message=show_message,
    )
示例#2
0
def delete_topic(token):
    key = 'account:delete-topic:%s' % token
    tid = redis.get(key)
    if not tid:
        abort(404)

    topic = Topic.query.get_or_404(int(tid))
    title = topic.title
    form = Form()
    show_message = False
    if form.validate_on_submit():
        with db.auto_commit():
            db.session.delete(topic)
        show_message = True
    return render_template(
        'account/delete-topic.html',
        title=title,
        form=form,
        show_message=show_message,
    )
示例#3
0
def get_email_from_signature(token, alt='signup'):
    key = 'account:%s:%s' % (alt, token)
    email = redis.get(key)
    if not email:
        return abort(404)
    return email, key
示例#4
0
def get_email_from_signature(token, alt='signup'):
    key = 'account:%s:%s' % (alt, token)
    email = redis.get(key)
    if not email:
        return abort(404)
    return email, key