Skip to Content
मेन्यू
This question has been flagged
3 Replies
23831 Views

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
Discard
Best Answer

Hi you can check this: 




Avatar
Discard
Best Answer

if condition TRUE:

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

else:

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

     

Avatar
Discard
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
Discard
Related Posts Replies Views Activity
2
अक्तू॰ 19
11267
0
मई 19
3659
0
जून 19
4273
1
अक्तू॰ 18
6257
2
जुल॰ 25
4654