[Zope] AUTHENTICATED_USER (or something) making me crazy

Phil Harris phil.harris@zope.co.uk
Sat, 7 Oct 2000 00:01:34 +0100


Dennis,

try:

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

Zope is 'celver' enough to realise that you must mean the username when you
do:

  <dtml-var AUTHENTICATED_USER>

but 'stupid' enough not to realise when you do:

<dtml-if "AUTHENTICATED_USER=='Anonymous User'">

Basic rule of thumb is that anythin in quotes is Python, and since AU is an
object, it must be treated as such.

btw, if you haven't yet got the Zope Quick Reference, get it now!

you still here, what you waiting for! - go get it now!  8¬)

http://zdp.zope.org

hth

Phil


----- Original Message -----
From: "Dennis Nichols" <nichols@tradingconnections.com>
To: <zope@zope.org>
Sent: Saturday, October 07, 2000 11:40 PM
Subject: [Zope] AUTHENTICATED_USER (or something) making me crazy


> 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 )