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!
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. >> >> >> 2012/7/29 Massimo Di Pierro <[email protected]> >> >>> I think this should be considered a bug. Than you check trunk? >>> >>> >>> On Sunday, 29 July 2012 05:37:51 UTC-5, weheh wrote: >>>> >>>> I haven't traced through all the code carefully, but >>>> is_impersonating() returns current.session.auth.**impersona**tor, >>>> which is based on a cPickle. So you're not getting a boolean, as you might >>>> be led to expect from the name of the function. >>>> >>>> >>>> On Sunday, July 29, 2012 1:38:42 PM UTC+8, mweissen wrote: >>>>> >>>>> I am using "impersonate" (great idea!) and I have a menu item which >>>>> should only appear when somebody is impersonated. I wrote >>>>> >>>>> ('end impersonate', False, URL('endimpersonate'),[],*auth. >>>>> is_impersonating()*) >>>>> >>>>> This did notwork, I had to write >>>>> >>>>> ('end impersonate', False, URL('endimpersonate'),[],*auth. >>>>> is_impersonating()!=None*) >>>>> >>>>> Why? >>>>> Regards, Martin >>>>> >>>>> >>> --

