[Zope] ZPT: User logged in?

Tino Wildenhain tino at wildenhain.de
Sat Oct 4 13:26:56 EDT 2003


Hi Florian,

Florian Lindner wrote:
> Tino Wildenhain wrote:
> 
>> Florian Lindner wrote:
>>
>>> Hello,
>>> how can I find out if the current user in a authentificated user or 
>>> just an anonymous, using Page Templates?
>>> Thanks,
>>> Florian
>>>
>> Simply: you don't.
>> Of course you can build somewhat obscure python expressions
>> into ZTP tal attributes, but as often, its much simpler in
>> a python script:
>>
>>
>> from AccessControl import getSecurityManager
>> return getSecurityManager().getUser().has_role("Authenticated")
> 
> 
> It works as far as it return 1 or 0, but my tal:condtion doesn't work:
> 
> <div style="margin-top:0.5em" 
> tal:condtion="here/Scripts/isAuthentificated" >
>   [...]
> </div>
> 
> What is wrong?
You made a typo,
it must be tal:condition, not tal:condtion

Regards
Tino




More information about the Zope mailing list