Try having Firebug or Chromebug open and on its Net tab when you do this. It should see the request from the AJAX post button, and I think it will probably show you that your view tries to redirect, but in the context of an AJAX request, the page you redirect to becomes the response body of the AJAX request, instead of being delivered to the browser as a page change.
If you want a page change, then you either (1) don't want to use AJAX for the button action, or (2) want to script a check for a response to the AJAX request and then change the page (or not) accordingly. As a general principle, any javascript that you are using for AJAX should watch for response success or failure and should make a visible behavior to indicate such success or failure, and that helps in debugging situations like this. On May 29, 10:39 pm, george hu <[email protected]> wrote: > Hi everyone, > > We have a view which uses json render: > @view_config(route_name='comment_post', renderer='json', > permission=ALL_PERMISSIONS) > > The above view is called by an Ajax post button, > > we also defined the login view, decorated with forbidden, as such: > > @view_config(route_name='login', renderer='spsocial:templates/auth/ > login.pt') > @forbidden_view_config(renderer='spsocial:templates/auth/login.pt') > def login(self): > login_url = self.request.route_url('login') > email = self.request.GET.get('email','') > from_r = self.request.GET.get('from_r','') > > referrer = self.request.url > .... > > from the print out of the referrer (comment_post) , I can see the login > view is called, but the page just stayed on the comment_post page, didn't > redirect to the login page. > > Any body know where is the problem? > > Thanks > > George Hu -- You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en.
