def form_page(): form = InputForm() input_word = form.data['input_word'] if form.validate_on_submit(): result = closest_match(input_word) flash(result, 'info') return render_template('form.html', title='Did you mean?', form=form)
def input(): form = InputForm() if form.validate_on_submit(): #flash('Wage requested: {}, City 1: {}, City 2: {}'.format( #form.wage.data, form.city1.data, form.city2.data)) return redirect(url_for('result')) return render_template(input.html, form = form)
def inputMahasiswa(): form = InputForm() if form.validate_on_submit(): mahasiswa = Mahasiswa(nama=form.nama.data, nim=form.nim.data, senin_a=form.senin_a.data + ('11'), senin_b=form.senin_b.data + ('12'), senin_d=form.senin_d.data + ('13'), senin_e=form.senin_e.data + ('14'), selasa_a=form.selasa_a.data + ('21'), selasa_b=form.selasa_b.data + ('22'), selasa_d=form.selasa_d.data + ('23'), selasa_e=form.selasa_e.data + ('24'), rabu_a=form.rabu_a.data + ('31'), rabu_b=form.rabu_b.data + ('32'), rabu_d=form.rabu_d.data + ('33'), rabu_e=form.rabu_e.data + ('34'), kamis_a=form.kamis_a.data + ('41'), kamis_b=form.kamis_b.data + ('42'), kamis_d=form.kamis_d.data + ('43'), kamis_e=form.kamis_e.data + ('44'), jumat_a=form.jumat_a.data + ('51'), jumat_b=form.jumat_b.data + ('52'), jumat_d=form.jumat_d.data + ('53'), jumat_f=form.jumat_f.data + ('54')) db.session.add(mahasiswa) db.session.commit() flash('Congratulations, data sudah masuk!') return redirect(url_for('inputMahasiswa')) return render_template('inputMahasiswa.html', title='Input Jadwal Mahasiswa', form=form)
def input(): form = InputForm() return(render_template('input.html', title='Cop?', form=form)) if form.validate_on_submit(): data = form['userinput'] return(redirect(url_for('input'))) return(render_template('input.html', title='What u tryna cop?', form=form))
def index(): form = InputForm() if form.validate_on_submit(): flash('Requested for handles {} {}'.format(form.fst_handle.data, form.snd_handle.data)) return redirect(url_for('index')) return render_template('index.html', title='Home', form=form)
def Wiki(): form = InputForm() if form.validate_on_submit(): entry = Entry(entry_text=form.entry.data, entry_title=form.entry_title.data, author=User.query.get(current_user.id)) db.session.add(entry) db.session.commit() return render_template('wiki.html', form=form)
def ajax(): form = InputForm() if form.validate_on_submit(): x = form.x.data y = form.y.data result = str(np.lcm(x, y)) # calculate & parse to string for jsonify return jsonify(result=result) return jsonify(result=form.errors)
def index(): form = InputForm(request.form) if request.method == 'GET': return render_template('input.html', form=form) elif request.method == 'POST' and form.validate(): response = run_model_main(form.claim.data, form.document.data) data = parse_response(response) return render_template('output.html', data=data) else: return "ERROR NOT SUPPORTED"
def index(): form = InputForm() if form.validate_on_submit(): attacker, defender = units_from_form(form) options = options_from_form(form) outcomes = calc.calculate(attacker, defender, options, test=False) defaults = form checkboxes = defaultdict(lambda: "") for opt in options.keys(): checkboxes[opt] = "checked" if options[opt] else "" hidden = defaultdict(lambda: False) for opt in options.keys(): if "hide" in opt: if "att_" in opt and not options["att_faction"].lower().split( "-")[0] in opt: hidden[opt] = True if "def_" in opt and not options["def_faction"].lower().split( "-")[0] in opt: hidden[opt] = True boxes = html_generator.make_boxes(checkboxes, hidden) return render_template('index.html', outcomes=outcomes, form=form, defaults=defaults, checkboxes=checkboxes, boxes=boxes) else: print("in else") flash_errors(form) outcomes = [0, 0, 0] defaults = defaultdict(lambda: {"data": "0"}) checkboxes = defaultdict(lambda: "") checkboxes["att_riskdirecthit"] = "checked" checkboxes["def_riskdirecthit"] = "checked" hidden = defaultdict(lambda: False) for opt in options_list(): if "hide" in opt: hidden[opt] = True boxes = html_generator.make_boxes(checkboxes, hidden) return render_template('index.html', outcomes=outcomes, form=form, defaults=defaults, checkboxes=checkboxes, boxes=boxes)
def grecha(): form = InputForm() global za_grechu cena = get_grechka() if form.validate_on_submit(): summa_grechku = ((form.var2.data * form.var1.data) * form.var3.data) kilkist_pachok = summa_grechku / 400 cena_za_vse = kilkist_pachok * cena za_grechu = cena_za_vse flash(' ціна : {}, кількість пачок на місяць: {} '.format( cena_za_vse, kilkist_pachok)) return render_template('home.html', form=form, cena=cena, title='Grecha')
def index(): # flash('input') form = InputForm() if form.validate_on_submit(): # do xx xhere to sql data = db.insertion(form, mydb) flash('SUCCESS! We recorded following infomation:') for i in (data): if i != '': flash(i) return render_template('input.html', title='3 In', form=form)
def calculate(): form = InputForm() if form.validate_on_submit( ): # need to insert the CSRF field in the HTML form flash("you have succesfully calculated") a = form.input_a_number.data b = a + 1 return render_template( 'calculate.html', form=form, output=b ) # these specified variables are the only variables go into the html file else: flash(f"the input number is {form.input_a_number.data}") return render_template('calculate.html', form=form)
def index(): form = InputForm() err = False if form.validate_on_submit(): result = algo.search(form.folder.data, form.keyword.data, form.algo.data, TEST_FOLDER) return render_template('index.html', title='String Matcher - 13518030', form=form, result=result, keyword=form.keyword.data) return render_template('index.html', title='String Matcher - 13518030', form=form)
def index(): print('hello') global freqlist #form = InputForm(request.form) #if request.method == 'POST': # Validator to verify that the input fulfills some criteron. # freq=request.form['frequency'] # print(freq) form = InputForm() cuserval = Userval.query.get(current_user.id) if request.method == 'POST': #form.validate_on_submit(): freqlist = [] cuserval.d1 = form.dc1.data cuserval.d2 = form.dc2.data cuserval.d3 = form.dc3.data cuserval.d4 = form.dc4.data cuserval.d5 = form.dc5.data cuserval.d6 = form.dc6.data cuserval.on_off = form.cv.data freqlist.append(steptofreq(form.dc1.data)) freqlist.append(steptofreq(form.dc2.data)) freqlist.append(steptofreq(form.dc3.data)) freqlist.append(steptofreq(form.dc4.data)) freqlist.append(steptofreq(form.dc5.data)) freqlist.append(steptofreq(form.dc6.data)) db.session.commit() get_tasks() current_time = datetime.datetime.utcnow() previous_time = current_time - datetime.timedelta( days=1, seconds=2, hours=5) previous_time2 = current_time - datetime.timedelta( days=4, seconds=5, hours=1) listofuses = [{ 'user': { 'username': '******' }, 'time': previous_time.strftime('%m/%d/%Y') }, { 'user': { 'username': '******' }, 'time': previous_time2.strftime('%m/%d/%Y') }] #frequencyval = request.form.get("freq_num","") return render_template('index.html', title='Home', ulist=listofuses, cuserval=cuserval, form=form, freqlist=freqlist)
def scale(): form = InputForm(request.form) if request.method == 'POST' and form.validate(): inquiry = form.inquiry.data x = 0 p = 0 for i in inquiry: x += ord(i.lower()) - 96 y = abs(x) % 10 if y == 0: p = 10 else: p = y answer = p else: answer = None return render_template("scale.html", form=form, answer=answer)
def index(): form = InputForm() if form.validate_on_submit(): user_search = Search(user_id=current_user.id, keyword=form.keyword.data, limit=form.limit.data) db.session.add(user_search) db.session.commit() keyword = form.keyword.data limit = form.limit.data flash("Search complete!") return redirect(url_for('results', name=keyword, limit=limit)) page = request.args.get('page', 1, type=int) searches = current_user.followed_searches().paginate( page, app.config['POSTS_PER_PAGE'], False) next_url = url_for('index', page=searches.next_num) \ if searches.has_next else None prev_url = url_for('index', page=searches.prev_num) \ if searches.has_prev else None return render_template('index.html', title='Home', form=form, searches=searches.items, next_url=next_url, prev_url=prev_url)
def irisapp(): form = InputForm() if form.validate_on_submit(): data = {"Inputs": {"input1":[{'Sepal-Length': form.sepallength.data, 'Sepal-Width': form.sepalwidth.data, 'Petal-Length': form.petallength.data, 'Petal-width': form.petalwidth.data, 'Class': "Iris-setosa", 'Class-Type': "1",}]},"GlobalParameters": {}} body = str.encode(json.dumps(data)) headers = {'Content-Type':'application/json', 'Authorization':('Bearer '+ api_key)} req = urllib.request.Request(url, body, headers) try: response = urllib.request.urlopen(req) result = response.read() except urllib.error.HTTPError as error: print("The request failed with status code: " + str(error.code)) # Print the headers - they include the requert ID and the timestamp, which are useful for debugging the failure print(error.info()) print(json.loads(error.read().decode("utf8", 'ignore'))) text = result.decode("utf-8").split(',') probs = {"Iris-Setosa":float(text[6].split('"')[5]), "Iris-Versicolor":float(text[7].split('"')[5]),\ "Iris-Virginica":float(text[8].split('"')[5])} print(probs) print("Predicted Iris type:",max(probs.items(), key=operator.itemgetter(1))[0]) flash("Predicted Iris type: {}".format(max(probs.items(), key=operator.itemgetter(1))[0]), 'prediction') for flowertype in probs: flash("{} probability: {}".format(flowertype,probs[flowertype]), 'probability') return redirect(url_for('irisapp')) return render_template('iris-app.html', title='Sign In', form=form)
def index(): form = InputForm() form.state.choices = [(k.upper()) for k, v in state_region.items()] if request.method == 'POST': return redirect(url_for('get_data', state=request.form.get('state'))) context = { 'form': form, } return render_template('index.html', **context)
def index(): form = InputForm() if form.validate_on_submit(): filename = mktemp() form.images.data.save(filename) unzip_path = os.path.join(app.root_path, f'../tmp/images/') converted_path = os.path.join(app.root_path, f'../tmp/converted/') unzip(filename, unzip_path) if os.path.isdir(converted_path): rmtree(converted_path) os.mkdir(converted_path) res = ai(os.listdir(unzip_path), unzip_path, converted_path) with open(os.path.join(converted_path, 'data.json'), 'w') as f: f.write(json.dumps(res)) # filename2 = mktemp() # form.audios.data.save(filename2) # unzip(filename2, os.path.join(app.root_path, f'../tmp/audios/')) return redirect('/game') else: return render_template('load_page.html', title="Hurt your friend", form=form, image='happy')
def index(): form = InputForm() if form.validate_on_submit(): # Get inputs from form attacker, defender = units_from_form(form) options = options_from_form(form) try: outcomes = calc.calculate(attacker, defender, options, test=False) except: error_print(attacker, defender, options) flash("Sorry, something went wrong in the calculation :(") outcomes = [0, 0, 0] traceback.print_exc() # Determine which checkboxes should remain checked checkboxes = defaultdict(lambda: "") for opt in options.keys(): checkboxes[opt] = "checked" if options[opt] else "" # Determine which options should be hidden hidden = defaultdict(lambda: False) for opt in options.keys(): if "hide" in opt: if "att_" in opt and not options["att_faction"].lower().split( "-")[0] in opt: hidden[opt] = True if "def_" in opt and not options["def_faction"].lower().split( "-")[0] in opt: hidden[opt] = True boxes = html_generator.make_boxes(checkboxes, hidden) # Remember numbers that were filled in defaults = form return render_template('index.html', outcomes=outcomes, form=form, defaults=defaults, checkboxes=checkboxes, boxes=boxes) else: flash_errors(form) outcomes = [0, 0, 0] defaults = defaultdict(lambda: {"data": "0"}) checkboxes = defaultdict(lambda: "") checkboxes["att_riskdirecthit"] = "checked" checkboxes["def_riskdirecthit"] = "checked" hidden = defaultdict(lambda: False) for opt in options_list(): if "hide" in opt: hidden[opt] = True boxes = html_generator.make_boxes(checkboxes, hidden) return render_template('index.html', outcomes=outcomes, form=form, defaults=defaults, checkboxes=checkboxes, boxes=boxes)
def calc(): form = InputForm() snrtimeform = SNRtimeForm() ccdform1 = CCDForm1() ccdform2 = CCDForm2() #snr = request.form['choice-calc'] #So that grapg appears after submit if ccdform1.validate_on_submit() or ccdform2.validate_on_submit(): result = True #Do the calculation based on selection: choice = request.form['choice-calc'] choiceccd = request.form['choice-ccd'] if choiceccd == 'ccd1': zeropoint = ccdform1.zeropoint1.data magnitude = ccdform1.magnitude1.data pixelscale = ccdform1.pixscale1.data skybrightness = ccdform1.skyb1.data radiusaperture = ccdform1.radius1.data readnoise = ccdform1.readnoise1.data gain = ccdform1.gain1.data darkcurrent = ccdform1.dark1.data elif choiceccd == 'ccd2': zeropoint = ccdform2.zeropoint2.data magnitude = ccdform2.magnitude2.data pixelscale = ccdform2.pixscale2.data skybrightness = ccdform2.skyb2.data radiusaperture = ccdform2.radius2.data readnoise = ccdform2.readnoise2.data gain = ccdform2.gain2.data darkcurrent = ccdform2.dark2.data if choice == 'snr': snr = snrtimeform.snr.data exptime = calctime(zeropoint, magnitude, pixelscale, skybrightness, radiusaperture, snr, readnoise, gain, darkcurrent) #exptime = snrtimeform.exptime.data #exptime = computeexptime(snr) finalcalc = 'Selected {}. SNR: {}, Exptime: {}. CCD selected: {}, ccdbins: {}, ccddark {}'.format( choice, snr, exptime, choiceccd, gain, darkcurrent) elif choice == 'time': exptime = snrtimeform.exptime.data snr = calcsnr(zeropoint, magnitude, pixelscale, skybrightness, radiusaperture, exptime, readnoise, gain, darkcurrent) #snr = snrtimeform.snr.data finalcalc = 'SSelected {}. SNR: {}, Exptime: {}. CCD selected: {}, ccdbins: {}, ccddark {}'.format( choice, snr, exptime, choiceccd, gain, darkcurrent) #BOkeh plot past example t, u = snrarray(zeropoint, magnitude, pixelscale, skybrightness, radiusaperture, readnoise, gain, darkcurrent) #If wanted to plot script, div, js, css = bplot(t, u) html = render_template('calc.html', plot_script=script, plot_div=div, js_resources=js, css_resources=css, title='O', form=form, snrtimeform=snrtimeform, finalcalc=finalcalc, ccdform1=ccdform1, ccdform2=ccdform2, result=result) else: result = None html = render_template('calc.html', title='O', form=form, snrtimeform=snrtimeform, ccdform1=ccdform1, ccdform2=ccdform2, result=result) return encode_utf8(html)
def containrize(): form = InputForm() if form.add.data: form.pkg_asked.append_entry() return render_template('containrize.html', title='Containrize', form=form, show_adv=True) # elif form.pkg_asked: # for item in form.pkg_asked: # if item.form.delete.data: # form.pkg_asked.entries.remove(item) # break print(form.validate_on_submit()) if form.validate_on_submit(): # TODO: support for DOI or other libraries # if form.doi.data: # task = build_image.apply_async(kwargs={'current_user_id': current_user.id, # 'doi': form.doi.data, # 'name': form.name.data, # 'preprocess': form.fix_code.data, # 'dataverse_key': os.environ.get('DATAVERSE_KEY')}) # else: # create directories if they don't exists yet if not os.path.exists(app.instance_path): os.makedirs(app.instance_path) if not os.path.exists(os.path.join(app.instance_path, 'r_datasets')): os.makedirs(os.path.join(app.instance_path, 'r_datasets')) if not os.path.exists(os.path.join(app.instance_path, 'py_datasets')): os.makedirs(os.path.join(app.instance_path, 'py_datasets')) if not os.path.exists(os.path.join(app.instance_path, 'temp')): os.makedirs(os.path.join(app.instance_path, 'temp')) else: shutil.rmtree(os.path.join(app.instance_path, 'temp')) os.makedirs(os.path.join(app.instance_path, 'temp')) print("MARK1") print(form.zip_file) if form.zip_file.data: zip_file = form.zip_file.data filename = secure_filename(zip_file.filename) if form.language.data == "Python": zipfile_path = os.path.join(app.instance_path, 'py_datasets', filename) else: zipfile_path = os.path.join(app.instance_path, 'r_datasets', filename) zip_file.save(zipfile_path) multi = 0 bool_dir = False with zipfile.ZipFile(zipfile_path) as myzip: namelist = myzip.infolist() for i in namelist: arr = i.filename.split('/') arr = list(filter(lambda x: x != '', arr)) if (len(arr) == 1): multi = multi + 1 if (i.is_dir()): bool_dir = True # zipList = list(zipfile.Path(myzip).iterdir()) if (multi != 1 or not (bool_dir)): f_name = filename[:(filename.index('.'))] os.makedirs( os.path.join(app.instance_path, 'py_datasets', f_name)) myzip.extractall( os.path.join(app.instance_path, 'py_datasets', f_name)) os.remove(zipfile_path) z = zipfile.ZipFile( os.path.join(app.instance_path, 'py_datasets', filename), 'w') p = os.path.join(app.instance_path, 'py_datasets', f_name) for root, dirs, files in os.walk(p): for file in files: z.write( os.path.join(root, file), os.path.relpath(os.path.join(root, file), os.path.join(p, '..'))) z.close() shutil.rmtree(os.path.join(app.instance_path, 'py_datasets', f_name), ignore_errors=True) else: filename = secure_filename(form.name.data + '.zip') if form.language.data == "Python": zipfile_path = os.path.join(app.instance_path, 'py_datasets', form.name.data + ".zip") else: zipfile_path = os.path.join(app.instance_path, 'r_datasets', form.name.data + ".zip") zip_file = zipfile.ZipFile(zipfile_path, "w") file_list = request.files.getlist('set_file') os.makedirs(os.path.join(app.instance_path, 'temp', form.name.data)) for f in file_list: f.save( os.path.join(app.instance_path, 'temp', form.name.data, f.filename)) pth = os.path.join(app.instance_path, 'temp', form.name.data) for root, dirs, files in os.walk(pth): for file in files: zip_file.write( os.path.join(pth, file), os.path.relpath(os.path.join(root, file), os.path.join(pth, '..'))) zip_file.close() print("MARK2") json_input = { 'user_id': current_user.id, 'zipfile_path': zipfile_path, 'name': form.name.data, "language": form.language.data, 'need_prepro': form.fix_code.data, 'extended_lib': form.extended_lib.data, 'adv_opt': None } json_ad_input = { 'cmd': form.command_line.data, 'sample_output': form.sample_output.data, 'code_btw': form.code_btw.data, 'prov': form.provenance.data } for value in json_ad_input.values(): if value is not None: json_input["adv_opt"] = json_ad_input break # covert the user package into json format user_pkgs_list = [] if form.pkg_asked.data: for entry in form.pkg_asked.data: print(entry) temp = { "pkg_name": entry['package_name'], "PypI_name": entry['pypI_name'] } user_pkgs_list.append(temp) user_pkgs_total = str({"pkg": user_pkgs_list}).replace('\'', '\"') print(str(user_pkgs_total)) # TODO: The backend function will be called here print("lang" + form.language.data) if form.language.data == "R": task = build_image.apply_async( kwargs={ 'zip_file': filename, 'current_user_id': current_user.id, 'name': form.name.data, 'preprocess': form.fix_code.data }) else: task = start_raas.apply_async( kwargs={ 'language': form.language.data, 'zip_file': filename, 'current_user_id': current_user.id, 'name': form.name.data, 'preprocess': form.fix_code.data, 'user_pkgs': user_pkgs_total, 'run_instr': form.command_line.data }) session['task_id'] = task.id return redirect(url_for('build_status')) print("MARK3") return render_template('containrize.html', title='Containrize', form=form, show_adv=False)
def index(): return render_template('index.html', title='Calculate', form=InputForm())
def input(): form = InputForm() return render_template('input.html', title='Input', form=form)
def index(): form = InputForm() return render_template('index.html', title='Обработка ФИО', form=form)
def input(): form = InputForm() if form.validate_on_submit(): return redirect(url_for('process', text=form.text.data)) return render_template('input.html', title='Input', form=form)
def predict(): ''' For Predicting and rendering results on HTML ''' form = InputForm() form.state.choices = [(k.upper()) for k, v in state_region.items()] ## Get back the state_name; look up by value, not ideal, need a better way to do this def get_key(value): for k, v in state_region.items(): for i in v: if value == i: state_name = k return state_name.upper() #use form data to make the prediction state_name = get_key(request.args['region']) region = request.args['region'] home_type = request.args['home_type'].lower() squarefeet = request.args['squarefeet'] beds = request.args['beds'] baths = request.args['baths'] pets = request.args['pets'] smoke = request.args['smoke'] laundry = request.args['laundry'].lower() parking = request.args['parking'].lower() features = [ region, home_type, squarefeet, beds, baths, pets, smoke, laundry, parking ] prediction = predict_rent(region, home_type, squarefeet, beds, baths, pets, smoke, laundry, parking) ### Submitting User Input to Firebase, initialize db and collection ### ref = db.reference('/user_input') #record date of submission today = date.today() # mm/dd/YY day = today.strftime("%m/%d/%Y") tz_NY = pytz.timezone('America/New_York') datetime_NY = datetime.now(tz_NY) print(datetime_NY.strftime("%H:%M:%S")) #Submits data to Firebabse ref.push({ 'date': day, 'time': datetime_NY.strftime("%H:%M:%S"), 'state': state_name, 'region': region, 'home_type': home_type, 'squarefeet': squarefeet, 'beds': beds, 'baths': baths, 'pets': pets, 'smoke': smoke, 'laundry': laundry, 'parking': parking, }) return render_template('index.html', prediction_text=f'{prediction}', features=features, form=form, state_name=state_name)
def calc2(): form = InputForm() snrtimeform = SNRtimeForm() ccdform1 = CCDForm1() #snr = request.form['choice-calc'] #So that grapg appears after submit if ccdform1.validate_on_submit() and snrtimeform.validate(): result = True #Do the calculation based on selection: choice = request.form['choice-calc'] #Define variables zeropoint = ccdform1.zeropoint1.data magnitude = ccdform1.magnitude1.data pixelscale = ccdform1.pixscale1.data skybrightness = ccdform1.skyb1.data radiusaperture = ccdform1.radius1.data readnoise = ccdform1.readnoise1.data gain = ccdform1.gain1.data darkcurrent = ccdform1.dark1.data if choice == 'snr': snr = snrtimeform.snr.data exptime = calctime(zeropoint, magnitude, pixelscale, skybrightness, radiusaperture, snr, readnoise, gain, darkcurrent) finalcalc = 'SNR: {}, Exposure Time: {} seconds. '.format( snr, exptime) elif choice == 'time': exptime = snrtimeform.exptime.data snr = calcsnr(zeropoint, magnitude, pixelscale, skybrightness, radiusaperture, exptime, readnoise, gain, darkcurrent) finalcalc = 'SNR: {}, Exposure Time: {} seconds. '.format( snr, exptime) #BOkeh plot from snrarray t, u = snrarray(zeropoint, magnitude, pixelscale, skybrightness, radiusaperture, readnoise, gain, darkcurrent) non = nonlinear(zeropoint, magnitude) sat = saturated(zeropoint, magnitude) #If wanted to plot script, div, js, css = bplot(t, u, non, sat) html = render_template('calc2.html', plot_script=script, plot_div=div, js_resources=js, css_resources=css, title='Exposure Time Calculator', form=form, snrtimeform=snrtimeform, finalcalc=finalcalc, ccdform1=ccdform1, choice=choice, result=result) # Vertical line else: result = None choice = None html = render_template('calc2.html', title='Exposure Time Calculator', form=form, snrtimeform=snrtimeform, ccdform1=ccdform1, choice=choice, result=result) return encode_utf8(html)
def newjob(): form_input = InputForm() if form_input.validate_on_submit(): #print("===2===") # Wird nach dem Submit unten bei ===1=== nochmal aufgerufen! # Pruefe, ob form_input.date_start.data und form_input.time_start.data # in der Tinydb bereits vorkommen! dtstr = form_input.date_start.data + "T" + form_input.time_start.data + ":00" msg = json.dumps({"cmd": "date-exists", "date": dtstr}) logger.info("queue_c_to_s.put: {}".format(msg)) if conf.IPC_FLAG: queue_c_to_s.put(msg) exists = queue_s_to_c.get() # True or False logger.info("queue_s_to_c.get: {}".format(exists)) if not exists: crts = "" if form_input.platz_1.data: crts = crts + "*" else: crts = crts + "." if form_input.platz_2.data: crts = crts + "*" else: crts = crts + "." if form_input.platz_3.data: crts = crts + "*" else: crts = crts + "." if form_input.platz_4.data: crts = crts + "*" else: crts = crts + "." if form_input.platz_5.data: crts = crts + "*" else: crts = crts + "." if form_input.platz_6.data: crts = crts + "*" else: crts = crts + "." if form_input.platz_7.data: crts = crts + "*" else: crts = crts + "." js = json.dumps({ "status": "active", "start": dtstr, "duration": int(form_input.time_dauer.data), "courts": crts, "cycle": form_input.zyklus_zeit.data }) msg = '{"cmd": "store-job", "job": ' + js + '}' logger.info('routes.py newjob/: {}'.format(msg)) if conf.IPC_FLAG: queue_c_to_s.put(msg) resp = queue_s_to_c.get() # ok else: flash("Der Auftrag existiert bereits") return redirect(url_for('jobs')) #print("===1===") return render_template('newjob.html', title='Neuer Job', form_input=form_input)