[Zope] AUTHENTICATED_USER (or something) making me crazy

knight knight@righteous.net
Sat, 7 Oct 2000 16:07:34 -0700 (PDT)


Dennis,

You might benefit from reading some of the general HOWTO's at
http://www.zope.org. Consider searching for "AUTHENTICATED_USER" or "user
manager".

A quick answer to your problem though:

AUTHENTICATED_USER is actually a class object (meaning it contains
variables of it's own, as well as functions). To _properly_ access the
data in the AUTHENTICATED_USER, you need to call upon the methods
(functions) that perform the task you want.

In this case, you want to compare the current user to some other value. In
that case, you want to call the getUserName method of AUTHENTICATED_USER.

Your code modified to work would be:

  <dtml-if "AUTHENTICATED_USER.getUserName()=='Anonymous User'">
    Guest
  <dtml-else>
    <dtml-var "AUTHENTICATED_USER.getUserName()">
  </dtml-if>

Regards,

Knight
knight@phunc.com

On Sat, 7 Oct 2000, Dennis Nichols wrote:

> If I inspect REQUEST by inserting a <dtml-var REQUEST> in my dtml I can see 
> that AUTHENTICATED_USER is set to Anonymous User. Yet when I insert the 
> following code, it never displays Guest. It takes the else branch and then, 
> perversely, displays Anonymous User. Please point out my stupid mistake.
> 
>     <dtml-if "AUTHENTICATED_USER=='Anonymous User'">
>       Guest
>     <dtml-else>
>       <dtml-var AUTHENTICATED_USER>
>     </dtml-if>
> 
> Thanks. Maybe I shouldn't work on Saturdays. Zope 2.2.2 roughly, Python 
> 1.5.2, RH 6.2
> 
> --
> Dennis Nichols
> nichols@tradingconnections.com
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 
>