On Apr 26, 3:17 pm, Bradley Wright <[email protected]> wrote:
> On Apr 26, 10:42 pm, Wyatt Baldwin <[email protected]>
> wrote:
>
> > If an object is in the session or request.environ (or any request/
> > thread-local place), you can access it from any middleware, assuming,
> > of course, that you shove the object into the environ before your
> > middleware is called.
>
> How do I put the correct details into the environ prior to the
> middleware getting called? At the moment I'm just using the __before__
> method of the BaseController.
I might just do this in a single piece of auth middleware instead of
letting it percolate into the app level. If you're using middleware
for auth now, you could add it there.
On the other hand, I don't see anything wrong with using your base
__before__. That's what I'm doing in my app. Basically:
if 'user' in session:
session['user'].touch()
else:
session['user'] = User(blah='blah') # user will touch self on
construction
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---