On Sat, May 30, 2009 at 5:23 AM, Scott <[email protected]> wrote:
>
> Erik, I've actually changed the code quite a bit but the problem i'm
> having still exists.
>
> You see trac (for whatever reason) doesn't call the authenticate()
> method once per request, it calls it quite a few times - which is why
> i'm having this problem. As for cookies, well i'm using my sites login
> cookies to log the users into trac, so they can jump between my site
> and trac seamlessly and without needing to re-login. My issue now is
> two fold, I want to make it so subsequent calls to this method return
> the users authenticated username (so i'm not doing multiple slow XML
> HTTP requests every load) and I also want to display login errors by
> calling chrome.add_notice(req, "Error loading login API.") but it
> seems anytime you use the "req" variable in this function trac goes
> into an infinite loop.
>
> help would be very much appreciated.

Yes, it calls your authenticate() every time req.authname is looked
up.  req.authname actually returns the result of a function call,
which loops through all Components that implement IAuthenticator and
returns the result of their authenticate() methods until one of them
returns something, or the list is exhausted (in which case it returns
'anonymous').  Look at trac.web.main.  So if you're checking
req.authname in your authenticate() method, then it will go into an
infinite loop.  Obviously you shouldn't do that, because your method
is what's *providing* the value for req.authname.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" 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/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to