@home.route('/download', methods=['GET', 'POST'])
@login_required
def download():
    form = DownloadEMLForm()
    form.filename.choices = list_data_packages(True, True)
    if form.validate_on_submit():
        filename = form.filename.data
        return_value = user_data.download_eml(filename=filename)
        if isinstance(return_value, str):
            flash(return_value)
        else:
            return return_value
    return render_template('download_eml.html', title='Download EML', form=form)
@home.route('/download', methods=['GET', 'POST'])
@login_required
def download():
    form = DownloadEMLForm()
    form.filename.choices = list_data_packages(True, True)
    if form.validate_on_submit():
        filename = form.filename.data
        return_value = user_data.download_eml(filename=filename)
        if isinstance(return_value, str):
            flash(return_value)
        else:
            return return_value
    return render_template('download_eml.html', title='Download EML', form=form)