Skip to Content
Menú
This question has been flagged
3 Respostes
23826 Vistes

Hi Guys,

My requirement is to redirect from '/web/login' to homepage (website) if condition is True.

@http.route('/web/login', type='http', auth="none")  
def web_login(self, redirect=None, **kw):
     # ...................
     if condition:
         return werkzeug.utils.redirect('/')

     # ....................


but result is

if not redirect and request.params['login_success']:
KeyError: 'login_success'

and also tried return http.local_redirect('/')

Please help me.

Avatar
Descartar
Best Answer

Hi you can check this: 




Avatar
Descartar
Best Answer

if condition TRUE:

      return request.render(module_name.templateID1')  or request.redirect('/')

else:

     return request.render('web.login', values)

     

Avatar
Descartar
Best Answer

Hi,

"KeyError" comes when dictionary has no key. Use request.params['login_success'] = False to define dict key.
I hope this helps you.

Avatar
Descartar
Related Posts Respostes Vistes Activitat
2
d’oct. 19
11267
0
de maig 19
3653
0
de juny 19
4271
1
d’oct. 18
6251
2
de jul. 25
4646