Hi Folks,

Sorry if this is a newbie question, but I'm having trouble figuring
out session management in pylons using the built in beaker module.

I am attempting to do session management and authentication using the
following:

class BaseController(WSGIController):

    requires_auth = False

    def __before__(self):

        # set up the session management
        self = SessionMiddleware(self, key="mykey",
secret="randomsecret")

        # Authentication required?
        if self.requires_auth and 'user' not in self.session:
            # Remember where we came from so that the user can be sent
there
            # after a successful login
            self.session['path_before_login'] = request.path_info
            self.session.save()
            return redirect_to(h.url_for(controller='login'))

on execution of a controller which subclasses BaseController, I get an
error which says that SessionMiddleware does not contain an attribute
"requires_auth".

I'm a pretty much complete python beginner, so I might just be missing
something with regard to how the __before__ method actually functions,
but this code is partially copied from an example I found on pylonshq
as to how to hack together quick and dirty authentication for
individual controllers.  In addition, I have completely guessed as to
how to use the SessionMiddleware object, and if anyone can point me to
more complete beaker documentation than that which is available on
their wiki, that would be an enormous help.

Thanks very much,

Richard

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to