I want to access couple of variables from if-block
, outside in the function
eg: i want to use signin
, user
@app.route('/signup', methods=['GET', 'POST'])
def register():
form1 = Signup()
if form1.validate_on_submit():
signin = auth_py.create_user_with_email_and_password(form1.email_address.data, form1.password.data)
user = auth_py.send_email_verification(signin['idToken']) # for email verification
name = form1.name.data
username = form1.username.data
email_address = form1.email_address.data
return redirect(url_for('home_page'))
if form1.errors != {}: # if no errors occur from validators
for err_msg in form1.errors.values():
print(f'there was an error creating the user {err_msg}')
database(username, name, email_address) # problem is here
return render_template('sign-up.html', form1=form1)
I want to use name
, username
and email_address
from form1.validate_on_submit()
inside database()
and i don't know how can i do that.
NOTE: there is some code yet to be written in main program so I cannot call
database()
function insideform1.validate_on_submit()