コード例 #1
0
def iepgengine():
    """Recieves an Excel file and launches the IEPG calculation. Returns
    an Excel with the results."""

    file = request.files["file"]

    if file is not None and file.filename.rsplit(".",
                                                 1)[1] in ["xlsx", "XLSX"]:
        filename = hashlib.md5(str(time.time()) + session["email"]).hexdigest()
        path_filename = os.path.join(backend["tmpFolder"], filename + ".xlsx")
        outFileName = os.path.join(backend["tmpFolder"],
                                   hashlib.md5(str(time.time())+session["email"]+"outputIEPGEngine").hexdigest()+ \
                                   ".xlsx")
        file.save(path_filename)
        flux = Flux()
        flux.calculusFromXLSXToXLSX(path_filename, outFileName)

        return (send_file(
            outFileName,
            mimetype=
            "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
            attachment_filename="Real_Instituto_Elcano-Calculo_IEPG.xlsx",
            as_attachment=True))

    else:
        return jsonify({"Error": "Bad file."})
コード例 #2
0
ファイル: calculus.py プロジェクト: GeographicaGS/Elcano-iepg
def iepgengine():
    """Recieves an Excel file and launches the IEPG calculation. Returns
    an Excel with the results."""
    
    file = request.files["file"]

    if file is not None and file.filename.rsplit(".",1)[1] in ["xlsx","XLSX"]:
        filename = hashlib.md5(str(time.time())+session["email"]).hexdigest()
        path_filename = os.path.join(backend["tmpFolder"], filename+".xlsx")
        outFileName = os.path.join(backend["tmpFolder"],
                                   hashlib.md5(str(time.time())+session["email"]+"outputIEPGEngine").hexdigest()+ \
                                   ".xlsx")
        file.save(path_filename)
        flux = Flux()
        flux.calculusFromXLSXToXLSX(path_filename,outFileName)

        return(send_file(outFileName, mimetype="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", 
                     attachment_filename="Real_Instituto_Elcano-Calculo_IEPG.xlsx",
                     as_attachment=True))

    else:
        return jsonify({"Error": "Bad file."})
コード例 #3
0
from common.flux import Flux

inputfilename = "data_calculus/year2015.xlsx"

Flux().calculusFromXLSXToWholeApplication(inputfilename)
コード例 #4
0
from common.flux import Flux
inputfilename = "data_calculus/year2015.xlsx"

flux = Flux()

#flux.calculusFromXLSXToWholeApplication(inputfilename)

outputfilename = "data_calculus/calculus2015.xlsx"
flux.calculusFromXLSXToXLSX(inputfilename,outputfilename)
コード例 #5
0
from common.flux import Flux
inputfilename = "data_calculus/year2015.xlsx"

flux = Flux()

#flux.calculusFromXLSXToWholeApplication(inputfilename)

outputfilename = "data_calculus/calculus2015.xlsx"
flux.calculusFromXLSXToXLSX(inputfilename, outputfilename)
コード例 #6
0
ファイル: updatecache.py プロジェクト: cayetanobv/Elcano-iepg
from common.flux import Flux

Flux().updateRedisCache()