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('/')
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('/')