def CeleryStoringTask(fileToStore, nameToStore, descToStore, endeToStore, locToStore, ownerToStore, startToStore): erg = pcapParser.storeFileIntoDataBase(UPLOAD_FOLDER + "/" + fileToStore, nameToStore) description_collection.insert_one({"Description": descToStore, "Ende": endeToStore, "Location": locToStore, "Name": nameToStore, "Owner": ownerToStore, "Start": startToStore}) queryHelper.makeIndizes(database, nameToStore)
def storeFiles(): if request.method == 'POST': fileToStore = str(request.form['file']) nameToStore = str(request.form['Name']) ownerToStore = str(request.form['Owner']) descToStore = str(request.form['Description']) startToStore = str(request.form['Start']) endeToStore = str(request.form['Ende']) locToStore = str(request.form['Location']) if not nameToStore: nameToStore = fileToStore[:len(fileToStore)-5] erg = pcapParser.storeFileIntoDataBase(UPLOAD_FOLDER + "/" + fileToStore, nameToStore) description_collection.insert_one({"Description": descToStore, "Ende": endeToStore, "Location": locToStore, "Name": nameToStore, "Owner": ownerToStore, "Start": startToStore}) queryHelper.makeIndizes(database, nameToStore) stats = [] stats.append(["Anzahl benoetigter Pakete", erg['pak']]) stats.append(["Benoetigte Laufzeit", erg['run']]) return render_template("backend/Success.html", action = "stored", itemType = "File as Collection", itemName = fileToStore, stats = stats) files = helper.fileNamesinUploads(UPLOAD_FOLDER) return render_template("backend/storeFiles.html", files = files)