Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (120 points)

my code main.py

@app.route("/", methods=['GET', 'POST'])

def customer():

    form = CustomerForm()

    if form.validate_on_submit():

        username = form.username.data

        email = form.email.data

        Streetaddress = form.Streetaddress.data

        Apt = form.Apt.data

        city = form.city.data

        state = form.state.data

        zipcode = form.zipcode.data

        country = form.country.data

        print(username)

        print(email)

        print(Streetaddress)

        print(Apt)

        print(city)

        print(state)

        print(zipcode)

        print(country)

        cursor = db.connection.cursor(MySQLdb.cursors.DictCursor)

        cursor.execute(

            "INSERT INTO customer_info.customer ('username', 'email', 'Streetaddress', 'Apt', 'city', 'state', 'zipcode', 'country')  VALUES(%s,%s,%s,%s,%s,%s,%s,%s)",

            "(username, email, Streetaddress, Apt, city, state, zipcode, country)")

        db.connection.commit()

this is cursor.py

if args is not None:

           if isinstance(args, dict):

                nargs = {}

                for key, item in args.items():

                    if isinstance(key, str):

                        key = key.encode(db.encoding)

                    nargs[key] = db.literal(item)

                args = nargs

            else:

                args = tuple(map(db.literal, args))

            try:

                query = query % args

            except TypeError as m:

            Error----->    raise ProgrammingError(str(m))

Please log in or register to answer this question.

Browse Categories

...