Beispiel #1
0
        flash(e.message)
        return redirect(url_for('home.home'))

    return redirect(url_for('route.add_attach_page', route_id=new_route.id))


@route_blueprint.route('/join/<route_id>/', methods=['GET'])
@login_required
def join(route_id):
    try:
        route_id = ObjectId(route_id)
        assert RouteHelper.get(route_id)
    except AssertionError, e:
        return redirect(url_for('home.home'))

    RouteHelper.join(route_id)
    return redirect(url_for('route.route_page', route_id=route_id))


@route_blueprint.route('/finish_attach/<route_id>/<attachment_id>/', methods=['GET'])
@login_required
def finish_attach(route_id, attachment_id):
    try:
        route_id = ObjectId(route_id)
        attachment_id = ObjectId(attachment_id)
        assert RouteHelper.get(route_id)
        assert AttachmentHelper.get(attachment_id)
    except AssertionError, e:
        return redirect(url_for('home.home'))

    RouteHelper.finish_attach(route_id, attachment_id)