No idea what I did but it seems to be working...after a week of this... grumble grumble :)
At any rate, now I'm on to a new problem...this one is probably (hopefully) simple to explain, giving my ignorance: I have to simple action tests on my controller so far and if I run them separately they pass, though if I uncomment one of the actions, I get an error that a certain table doesn't exist (which it should on set-up, and does when I run the test by itself). Neither of these actions are reliant on each other; one is an index showing a listing of a collection; the other is a create action accepting fields from a form to create an item... On Aug 24, 5:29 pm, Wojtek Augustynski <[email protected]> wrote: > Though I won't get the User object and would have to rely on my model to > have the user_name to be unique for look ups. > The problem for me isn't that I can't get the user name variable, its that > nosetests choke on it (it works perfectly well outside of testing)... > identity = request.environ.get('repoze.who.identity') returns as None when > running Nosetests but not outside of it. > > > > On Tue, Aug 24, 2010 at 5:23 PM, saurabh <[email protected]> wrote: > > 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]<pylons-discuss%2bunsubscr...@go > > oglegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/pylons-discuss?hl=en. -- 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.
