[Zope] Python version of a DTML thing

Jim Washington jwashin@vt.edu
Mon, 17 Jun 2002 19:11:42 -0400


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