Example #1
0
def convert():
    xml_source = request.files['xmlFile']
    msg_source = request.files['msgFile']

    if xml_source.filename == '' or msg_source.filename == '':
        flash('Please upload valid Xml and Msg files')
        return redirect(url_for('default'))

    msg_result = BytesIO()
    hsh_result = BytesIO()

    try:
        converter.convert(xml_source.stream, msg_source.stream, msg_result)

        msg_result.seek(0)
        hsh_result.write(converter.generate_integrity_hash(msg_result))

        msg_result.seek(0)
        hsh_result.seek(0)
        zip_stream = generate_zipfile(msg_result.getvalue(),
                                      hsh_result.getvalue(), 'result')
        return send_file(zip_stream,
                         attachment_filename='result.zip',
                         as_attachment=True)
    except Exception as ex:
        flash(type(ex).__name__ + ' - ' + str(ex.args))
        return redirect(url_for('default'))
def convert():
    xml_source = request.files['xmlFile']
    msg_source = request.files['msgFile']

    if xml_source.filename == '' or msg_source.filename == '':
        flash('Please upload valid Xml and Msg files')
        return redirect(url_for('default'))

    msg_result = BytesIO()
    hsh_result = BytesIO()

    try:
        converter.convert(xml_source.stream, msg_source.stream, msg_result)

        msg_result.seek(0)
        hsh_result.write(converter.generate_integrity_hash(msg_result))

        msg_result.seek(0)
        hsh_result.seek(0)
        zip_stream = generate_zipfile(msg_result.getvalue(),
                                      hsh_result.getvalue(),
                                      'result')
        return send_file(zip_stream,
                         attachment_filename='result.zip',
                         as_attachment=True)
    except Exception as ex:
        flash(type(ex).__name__ + ' - ' + str(ex.args))
        return redirect(url_for('default'))
Example #3
0
def createchecksum():
    msg_source = request.files['msgFile']

    if msg_source.filename == '':
        flash('Please upload valid Msg file')
        return redirect(url_for('default'))

    hsh_result = BytesIO()

    try:
        hsh_result.write(converter.generate_integrity_hash(msg_source.stream))
        hsh_result.seek(0)

        name, _ = path.splitext(msg_source.filename)
        return send_file(hsh_result,
                         attachment_filename=name + '.hsh',
                         as_attachment=True)
    except Exception as ex:
        flash(type(ex).__name__ + ' - ' + str(ex.args))
        return redirect(url_for('default'))
def createchecksum():
    msg_source = request.files['msgFile']

    if msg_source.filename == '':
        flash('Please upload valid Msg file')
        return redirect(url_for('default'))

    hsh_result = BytesIO()

    try:
        hsh_result.write(converter.generate_integrity_hash(msg_source.stream))
        hsh_result.seek(0)

        name, _ = path.splitext(msg_source.filename)
        return send_file(hsh_result,
                         attachment_filename=name + '.hsh',
                         as_attachment=True)
    except Exception as ex:
        flash(type(ex).__name__ + ' - ' + str(ex.args))
        return redirect(url_for('default'))