Care to explain how I would do this?

On May 6, 10:35 pm, Erik Bray <[email protected]> wrote:
> On Tue, May 5, 2009 at 6:34 AM, Scott <[email protected]> wrote:
>
> > Hi all, I've never coded python or trac before so please excuse me if
> > what I am doing is totally wrong, but I cannot for the life of me
> > figure this out.
>
> > What i've done is totally rip out the trac session / login system,
> > because what I want to do is replace it with an XML API call to a URL
> > on my website. The basic code is:
>
> > -----
>
> >IAuthenticator
> > authenticate method
>
> >  if we haven't already checked
> >   call api to validate user
>
> > return valid or not
>
> > -----
>
> > Problem is, it seems trac or python remembers all values set to the
> > self.authenticated field, across every refresh, even if different
> > people are viewing the page. How can I make it so this function runs
> > once every page reload, saves if the user is authenticated and thats
> > it? My code is:
>
> > -----
>
> > import sys, urllib
>
> > from genshi.builder import tag
> > from xml.dom import minidom
> > from trac.core import *
> > from trac.web.api importIAuthenticator
> > from trac.web import chrome
> > from trac.web.chrome import INavigationContributor
> > from trac.db.api import DatabaseManager
> > from trac.config import Option
>
> > class AuthXMLModule(Component):
> >    """ Automatically try and login anonymous users on each request.
> > """
>
> >    implements(IAuthenticator, INavigationContributor)
>
> >    authenticated = False
> >    authname = None
>
>  ...snip...
>
> You made authenticated and authname class attributes.  Don't do that.
> Their values will persist between requests for as long as your web
> server is running.
--~--~---------~--~----~------------~-------~--~----~
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