Try this: c.user = identity['repoze.who.userid'] #This should give you the user_name in c.user variable
Saurabh On Aug 24, 1:27 pm, waugust <[email protected]> wrote: > Hey all, > > I've asked this before without answer and I've tried the repoze board > as well... > Gotta post it back up, if anyone could please help: > > Hmm... so I pulled Gustavo's sample pylons auth > app:http://wiki.pylonshq.com/display/pylonscookbook/Authorization+with+re... > I added: > identity = request.environ.get('repoze.who.identity') > c.user = identity.get('user').user_name > to the index action of the PanelController (protected with the > in_group predicate) and came up with the same error (only in > testing): > AttributeError: 'NoneType' object has no attribute 'get' > Not running a nosetest, the context variable resolves in the > template. > Is it wrong to define the user name, from the session credentials, in > the controller to the template context like this? > What am I missing? I have to be wrong, right? wouldn't others be > getting the same problem? > P.S. the nosetests pass as they were before the addition...and that > was testing > > I've got repoze.who_testutil-1.0 installed and I've tried this on > shabti templates and without (as stated above, I even tried Gustavo's > sample pylons app with repoze.what auth) > > In the past, I've also tried to pass the repoze.what.credentials to > extra_environ all with no success. > > I've been trying this for over a week now...anybody? -- 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.
