@home.route('/create', methods=['GET', 'POST'])
@login_required
def create():
    form = CreateEMLForm()
    help = get_helps(['new_eml_document'])
    if (request.method == 'POST'):
        if (BTN_CANCEL in request.form):
            return redirect(get_back_url())
        if form.validate_on_submit():
            filename = form.filename.data
            user_filenames = user_data.get_user_document_list()
            if (user_filenames and filename and (filename in user_filenames)):
                flash(f'{filename} already exists')
                return render_template('create_eml.html', help=help, form=form)
            create_eml(filename=filename)
            current_user.set_filename(filename)
            current_user.set_packageid(None)
            return redirect(url_for(PAGE_TITLE, filename=filename))
    return render_template('create_eml.html', help=help, form=form)
@home.route('/create', methods=['GET', 'POST'])
@login_required
def create():
    form = CreateEMLForm()
    help = get_helps(['new_eml_document'])
    if (request.method == 'POST'):
        if (BTN_CANCEL in request.form):
            return redirect(get_back_url())
        if form.validate_on_submit():
            filename = form.filename.data
            user_filenames = user_data.get_user_document_list()
            if (user_filenames and filename and (filename in user_filenames)):
                flash(f'{filename} already exists')
                return render_template('create_eml.html', help=help, form=form)
            create_eml(filename=filename)
            current_user.set_filename(filename)
            current_user.set_packageid(None)
            return redirect(url_for(PAGE_TITLE, filename=filename))
    return render_template('create_eml.html', help=help, form=form)