示例#1
0
def index():
    form = Form()

    if request.method == 'POST':
        if form.validate_on_submit():
            details = request.form
            Emal = form.Email, sex = form.sex, age = form.age,
            Marital = form.Marital, county = form.county,
            Property = form.Property, PropertyStatus = form.PropertyStatus,
            AmountPaid = form.AmountPaid, Rooms = form.Rooms,
            People = form.People
            db(
                "INSERT INTO survey(Email, sex, age, Marital, county, Property, PropertyStatus, AmountPaid, Rooms, People) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",
                (Email, sex, age, Marital, county, Property, PropertyStatus,
                 AmountPaid, Rooms, People))
            # db.connection.commit()
            #cursor = db.cursor()

            # db.close()
            flash(u'Something went wrong!', 'success')

        else:
            flash(u'Thank you for your collaboration!', 'error')
        return redirect(url_for('index'))
    return render_template('index1.html', form=form)
示例#2
0
def index():
    cwd1 = os.getcwd()
    cwd2 = cwd1[0:-9]
    name = None
    email = None
    #sequence = None
    form = Form()
    if form.validate_on_submit():
        name = form.name.data
        surname = form.surname.data
        email = form.email.data
        #sequence = form.sequence.data
        database = form.database.data
        #write_to_disk(name,surname, email)
        filename = secure_filename(form.file.data.filename)
        form.file.data.save("/var/www/html/Web-BLCA/mainLoop/" + filename)


        open("/var/www/html/Web-BLCA/mainLoop/seqfile.fasta", "w+").write(database+"\n")
        open("/var/www/html/Web-BLCA/mainLoop/preq.txt", "a").write(name + "\n" + email + "\n" + filename + "\n" + database+"\n")
        form.name.data = ''
        form.email.data = ''
        #form.sequence.data = ''
        form.surname.data = form.database.data = ''
        flash("Thank you! Your Job has been submitted!", "success")
    return render_template('home.html', form=form)