[Zope] Python version of a DTML thing

Aseem Mohanty aseem@neurobehavioralsystems.com
Mon, 17 Jun 2002 07:01:26 -0700


Actually I found another (easier??) way..

In the bindings tab for PyScript put namespace = _ or for that matter 
anything else (with restrictions)
and then just call _.SecurityGetUser()

-AM

Jim Washington wrote:

> Aseem Mohanty wrote:
>
>> I get an attribute error for SecurityGetUser()...
>> How to get around that?
>>
>> TIA
>> AM
>>
>> Max M wrote:
>>
>>> Aseem Mohanty wrote:
>>>
>>>> How do I do the following :
>>>>
>>>> <dtml-let user="_.SecurityGetUser()">
>>>>
>>>> I mean the SecurityGetUser()
>>>>
>>>> user=???
>>>
>>>
>>>
>>>
>>>
>>> user = context.SecurityGetUser()
>>>
> I did some digging, and the following will work:
>
> from AccessControl import getSecurityManager
> sm = getSecurityManager()
> user = sm.getUser()
> username = user.getUserName()
>
> Supposedly, this does not have the problems that AUTHENTICATED_USER has.
>
> -- Jim Washington
>
>
>

-- 
==================================================================
 Aseem Mohanty							   
 Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 
 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231		  	
==================================================================								  	
 "I saw `cout' being shifted "Hello world" times to the left and  
  stopped right there!!"                        -- Steve Gonedes  
==================================================================