On 3 Aug 2012, at 4:50 AM, Martin Weissenboeck <[email protected]> wrote: > Sorry, my tests were wrong. Please forget my last mail. > I think I have mixed two versions on my computer. I have tested it again and > now is_imperonating works as expected. > Thank you!
That's good. I've been trying to reproduce it in a test case, and failing. I thought maybe that Storage needed to implement __contains__, but I couldn't figure out why... > > 2012/8/3 Massimo Di Pierro <[email protected]> > Clearly there is a problem with that function. If auth is defined, I'd expect > > >>> a=dict() > >>> 'x' in a > False > >>> a=dict(x=1) > >>> 'x' in a > True > >>> > > The problem I have is that it fails when the user is not logged in. > Perhaps this is the related to your problem? > > I have a possible fix in trunk. Please check that it returns True/False. It > does for me. > > On Friday, 3 August 2012 00:34:05 UTC-5, mweissen wrote: > Interesting results (Version 2.00.0 (2012-08-02 21:51:02) dev) > > From tools.py: > > def is_impersonating(self): > return 'impersonator' in current.session.auth > > The return value of is_impersonating is not False or True but None or the > whole current.session.auth as string. > A change in tools.py to > > def is_impersonating(self): > return ('impersonator' in current.session.auth) != None > > works, but I cannot understand why the in-operator has not the results False > or True. --

