コード例 #1
0
ファイル: views.py プロジェクト: chromakode/postcards
def publish():
    id = int(request.form['postcard-id'])
    postcard = Postcard._byID(id)
    if postcard.deleted or postcard.published:
        abort(403)
    postcard.published = True
    db.session.commit()

    generate_jsonp()
    submit_link_to_postcard(postcard.id)
    send_gold_claim_message(postcard.id)
    enflair_user(postcard.user)

    flash('postcard published!')
    return redirect('/')
コード例 #2
0
ファイル: views.py プロジェクト: chromakode/postcards
def publish():
    id = int(request.form['postcard-id'])
    postcard = Postcard._byID(id)
    if postcard.deleted or postcard.published:
        abort(403)
    postcard.published = True
    db.session.commit()

    generate_jsonp()
    submit_link_to_postcard(postcard.id)
    send_gold_claim_message(postcard.id)
    enflair_user(postcard.user)

    flash('postcard published!')
    return redirect('/')
コード例 #3
0
ファイル: views.py プロジェクト: MelissaCole/postcards
def publish(id):
    postcard = Postcard._byID(id)
    if postcard.deleted or postcard.published:
        abort(403)
    postcard.published = True
    db.session.commit()

    generate_jsonp()
    submit_link_to_postcard(postcard.id)
    send_gold_claim_message(postcard.id)
    enflair_user(postcard.user)

    if request.headers['X-Requested-With'] == 'XMLHttpRequest':
        return 'success!'
    else:
        flash('postcard published!')
        return redirect('/')
コード例 #4
0
ファイル: views.py プロジェクト: MelissaCole/postcards
def delete(id):
    postcard = Postcard._byID(id)
    if postcard.deleted:
        abort(403)
    postcard.deleted = True
    db.session.commit()

    # clean up if necessary
    if postcard.published:
        remove_all_images(id)
        generate_jsonp()

    if request.headers.get('X-Requested-With') == 'XMLHttpRequest':
        return 'success!'
    else:
        flash('postcard deleted!')
        return redirect('/')
コード例 #5
0
def publish(id):
    postcard = Postcard._byID(id)
    if postcard.deleted or postcard.published:
        abort(403)
    postcard.published = True
    db.session.commit()

    generate_jsonp()
    submit_link_to_postcard(postcard.id)
    send_gold_claim_message(postcard.id)
    enflair_user(postcard.user)

    if request.headers['X-Requested-With'] == 'XMLHttpRequest':
        return 'success!'
    else:
        flash('postcard published!')
        return redirect('/')
コード例 #6
0
def delete(id):
    postcard = Postcard._byID(id)
    if postcard.deleted:
        abort(403)
    postcard.deleted = True
    db.session.commit()

    # clean up if necessary
    if postcard.published:
        remove_all_images(id)
        generate_jsonp()

    if request.headers.get('X-Requested-With') == 'XMLHttpRequest':
        return 'success!'
    else:
        flash('postcard deleted!')
        return redirect('/')