html - Name of the user not getting displayed in python code -


i have made signup page using python. following link code :

signup page 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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -