Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
23786 Weergaven

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
Annuleer
Beste antwoord

Hi you can check this: 




Avatar
Annuleer
Beste antwoord

if condition TRUE:

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

else:

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

     

Avatar
Annuleer
Beste antwoord

Hi,

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

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
okt. 19
11244
0
mei 19
3629
0
jun. 19
4255
1
okt. 18
6238
2
jul. 25
4604