Hi, everyone:

In my page template, I would like to show one message if the request
is authenticated, and other if the user has not logged in.

Is there a simple test I can use in the template file like?

<span tal:condition="request/unauthenticated">Please Log In</span>
<span tal:condition="not request/unauthenticated">Hello Mr. XXX</span>

Similiar thing used to work with Zope2. But with Zope3, request only
has an attribute 'principal', which will return a
<zope.app.security.principalregistry.UnauthenticatedPrincipal object
at 0x969d6ec> object.

I have seen code doing verification in the view class like this:

if (not IUnauthenticatedPrincipal.providedBy(request.principal):
  ...

But surely there will be a much simpler way to do this?

-- 
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to