Sweet! Thanks Diez. I'll work with that this week and let you know how it goes.
On Apr 28, 7:59 am, "Diez B. Roggisch" <[email protected]> wrote: > On Wednesday 28 April 2010 13:06:46 robneville73 wrote: > > > > > > > Right, so I can use the same predicates, but my main problem is, can > > it handle.... > > > @require(foo) > > def mycontrollermethod(self): > > somestuff > > > an unauthenticated call to mycontrollermethod from a browser that > > results in a redirect to the HTML login form > > AND > > an unauthenticated call to mycontrollermethod from a Flex/Flash > > application that results in no redirection, but instead returns an > > HTTP 401 so that the Flex/Flash app can deal with it? > > > It appeared to me that it could handle scenario #2 OK, but not both at > > the same time...but I hope I'm wrong because that would be cool :) As > > I said before, in the WSGI stack, I've already added middleware to > > insert an flag in the environment that distinguishes one from the > > other but I'm unclear how to translate that into the behavior I'm > > looking for. > > Of course it can - it's part of the denial-handler. You can write your own > that does - depending on environ-state - does redirects or returns an status > code. > > Just make your custom denial handler either perform a normal redirect (that's > what it usually does, so take a look at the default implementation), or > perform an "internal redirect" to a location that renders the 401. > > 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 > athttp://groups.google.com/group/turbogears?hl=en. -- 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.

