def post_to_broadcast(broadcast_id): assert flask.request.method == 'POST', \ 'must use POST to publish things' try: data = flask.request.json except ValueError: # asserts cause a 400 to fire. this is a hack, but it's hack week. assert False, "'data' must be a valid JSON string" return {"screen_ids": model.publish(broadcast_id, data)}
def publish(id): # Publish an article, removing the 'draft' status article = model.get_article(id) if session['logged']: model.publish(article) return redirect(url_for('view_post', id=int(id)))