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 <massimo.dipie...@gmail.com>

> 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.**impersonator, 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
>>>
>>>
>

-- 



Reply via email to