On Wednesday, November 24, 2010 06:48:08 ozwyzard wrote: > When a user uses a typical browser to access a page that requires > authentication, TG2 automatically responds with redirect to the login > page (along with 'came_from 'parameter in the login url). > > However, I have a scenario where a state-machine driven program > accesses the same page, and expects an HTTP 401 response in order to > retry with authentication credentials. > > I would like TG2 to redirect to login page for some browsers, but not > for some others. How would I go about achieving this? I have control > over the program which expects the 401 response. Should I send some > special X-header in the HTTP request and handle it by means of (a) > some magic (or config) in repoze.who, or (b) some other TG2 config, or > (c) some middleware? > > I was unable to locate any specific info in the 'Pylons' book to solve > the above.
This can be done using repoze.who plugins. Search this list for mentionings of it, there have been discussions about this before. And yes, you need of course to have some distinguishing criteria for them to render a different response. Diez -- 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.

