def start_job(service_id, upload_id):
    upload_data = session['upload_data']

    if request.files or not upload_data.get('valid'):
        # The csv was invalid, validate the csv again
        return send_messages(service_id, upload_data.get('template_id'))

    session.pop('upload_data')

    job_api_client.create_job(
        upload_id,
        service_id,
        upload_data.get('template_id'),
        upload_data.get('original_file_name'),
        upload_data.get('notification_count'),
        scheduled_for=request.form.get('scheduled_for', '')
    )

    return redirect(
        url_for(
            'main.view_job',
            job_id=upload_id,
            service_id=service_id,
            help=request.form.get('help'),
            just_sent='yes',
        )
    )
Exemple #2
0
def start_job(service_id, upload_id):
    try:
        upload_data = session['file_uploads'][upload_id]
    except KeyError:
        current_app.logger.exception('upload_id not in session')
        return redirect(url_for('main.choose_template', service_id=service_id), code=301)

    if request.files or not upload_data.get('valid'):
        # The csv was invalid, validate the csv again
        return send_messages(service_id, upload_data.get('template_id'))

    session['file_uploads'].pop(upload_id)

    job_api_client.create_job(
        upload_id,
        service_id,
        upload_data.get('template_id'),
        request.args.get('original_file_name'),
        upload_data.get('notification_count'),
        scheduled_for=request.form.get('scheduled_for', '')
    )

    return redirect(
        url_for(
            'main.view_job',
            job_id=upload_id,
            service_id=service_id,
            help=request.form.get('help'),
            just_sent='yes',
        )
    )
Exemple #3
0
def start_job(service_id, upload_id):

    job_api_client.create_job(upload_id,
                              service_id,
                              scheduled_for=request.form.get(
                                  'scheduled_for', ''))

    return redirect(
        url_for(
            'main.view_job',
            job_id=upload_id,
            service_id=service_id,
            help=request.form.get('help'),
            just_sent='yes',
        ))
Exemple #4
0
def start_job(service_id, upload_id):

    job_api_client.create_job(upload_id,
                              service_id,
                              scheduled_for=request.form.get(
                                  "scheduled_for", ""))

    session.pop("sender_id", None)

    return redirect(
        url_for(
            "main.view_job",
            job_id=upload_id,
            service_id=service_id,
            help=request.form.get("help"),
            just_sent="yes",
        ))
Exemple #5
0
def start_job(service_id, upload_id):

    job_api_client.create_job(
        upload_id,
        service_id,
        scheduled_for=request.form.get('scheduled_for', ''),
        contact_list_id=request.form.get('contact_list_id', ''),
    )

    session.pop('sender_id', None)

    return redirect(
        url_for(
            'main.view_job',
            job_id=upload_id,
            service_id=service_id,
            just_sent='yes',
        ))
Exemple #6
0
def start_job(service_id, upload_id):

    upload_data = session['upload_data']

    if request.files or not upload_data.get('valid'):
        # The csv was invalid, validate the csv again
        return send_messages(service_id, upload_data.get('template_id'))

    session.pop('upload_data')

    job_api_client.create_job(
        upload_id,
        service_id,
        upload_data.get('template_id'),
        upload_data.get('original_file_name'),
        upload_data.get('notification_count')
    )

    return redirect(
        url_for('main.view_job', job_id=upload_id, service_id=service_id, help=request.form.get('help'))
    )