Exemplo n.º 1
0
def add_posts():

    ch_name = request.form.get("ch_name")

    if Channel.exists(ch_name):
        return Channel.jsonify_posts(ch_name)
    else:
        return jsonify({"error": True})
Exemplo n.º 2
0
def channel_exists():
    ch_name = request.form.get("channel")
    ch_owner = request.form.get("owner")

    if Channel.exists(ch_name):
        return jsonify({"success": False})
    else:
        # add new channel immediately to avoid duplicate being added at same time
        Channel(ch_name, ch_owner)  # create new channel object
        return jsonify({"success": True})