html - Name of the user not getting displayed in python code -
i have made signup page using python. following link code :
as user signs up, should redirected /welcome
says :
welcome user
but cannot display above mentioned code.
whereas when write
self.redirect('/welcome?username = '+user)
i redirected page says
welcome user
why so?
when write:
self.redirect('/welcome?username=' + user) #no whitespaces in url
you adding url parameter(of type name=value), in case username=user. so, when welcomehandler class handles request:
username=self.request.get('username')
it sets username value of parameter in url name 'username' (username = user) , welcome message correctly displayed. if you:
self.redirect('/welcome')
there no parameters in url , username set default empty string , welcome displayed.
check here request documentation.
Comments
Post a Comment