Hi all, I am new for TG2. I created a TG project through "paster
quicktstart". And it is very strange to me that the implementation of
default login_handler cannot be found. I tried some tests about it and
it seemed very interesting.

1. I rewrite the root.py to be a very simple one in order to
understand TG, like bellow:
           # -*- coding: utf-8 -*-
           """Main Controller"""
           from tg import expose, url
           from bookshare.lib.base import BaseController

           __all__ = ['RootController']

          class RootController(BaseController):

              @expose('bookshare.templates.index')
              def index(self):
                    return dict(page = 'index')

              @expose('bookshare.templates.login')
              def login(self):
                    return dict(page = 'login', came_from = '/',
login_counter = '0')

2. I removed two configurations in app_cfg.py:
           #base_config.sa_auth.post_login_url = '/post_login'
           #base_config.sa_auth.post_logout_url = '/post_logout'

3. Then in app_cfg.py file, I added one line of new configuration like
bellow:
         base_config.sa_auth.login_handler = '/authenticate'

4. Then I tried to login the system, and got the error. It was what I
expected

5. Then I changed the login.html under template folder like bellow:
         ${tg.url('/login_hander',  -----> ${tg.url('/authenticate',

6. When I tried the login again, I could login the system without any
errors.

So, it seems that if the URL in app_cfg.py file was same with
login.html template, even it was not "/login_handler", the login could
work normally. Then the question is, where and what is the
implementation of default "/login_handler"? Please help to give some
advices. Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to