[Zope] AUTHENTICATED_USER Question

schenck schenck@ultra.posc.org
Mon, 24 Jan 2000 16:26:42 -0600


Thanks.  Your suggestion works, but it is not what was published in the
magazine article.  Where do I find the documentation explaining this?  I
couldn't see any thing about has_role in the DTML reference.

Dan

-----Original Message-----
From: Phil Harris [mailto:phil.harris@zope.co.uk]
Sent: Monday, January 24, 2000 4:12 PM
To: schenck; zope@zope.org
Subject: Re: [Zope] AUTHENTICATED_USER Question


Shouldn't that be

<dtml-if "AUTHENTICATED_USER.has_role(['Manager'])">

??

HTH

Phil
phil.harris@zope.co.uk
----- Original Message -----
From: "schenck" <schenck@ultra.posc.org>
To: <zope@zope.org>
Sent: Monday, January 24, 2000 9:53 PM
Subject: [Zope] AUTHENTICATED_USER Question


> An earlier note on this list referred to a Zope article by Jon Udell
in
> Byte.  In that article Jon included the following bit of code in a
> <dtml-calendar ...> example:
>
>     <dtml-if "AUTHENTICATED_USER.has_role()=='Manager'">
>
> When I try to execute this code using Zope 2.1.2 on Windows I get the
> following error:
>
> ===============================================
> Error Type: TypeError
>             Error Value: not enough arguments; expected 2, got 1
>
> Traceback (innermost last):
>   File D:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line
214,
> in publish_module
>   File D:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line
179,
> in publish
>   File D:\Program Files\Zope\lib\python\Zope\__init__.py, line 202, in
> zpublisher_exception_hook
>     (Object: ElementWithAttributes)
>   File D:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line
165,
> in publish
>   File D:\Program Files\Zope\lib\python\ZPublisher\mapply.py, line
160,
> in mapply
>     (Object: testCalendar)
>   File D:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line
102,
> in call_object
>     (Object: testCalendar)
>   File D:\Program Files\Zope\lib\python\OFS\DTMLMethod.py, line 145,
in
> __call__
>     (Object: testCalendar)
>   File D:\Program Files\Zope\lib\python\DocumentTemplate\DT_String.py,
> line 502, in __call__
>     (Object: testCalendar)
>   File d:\Program
> Files\Zope\lib\python\Products\Calendar\CalendarTag.py, line 276, in
> render
>   File d:\Program
> Files\Zope\lib\python\Products\Calendar\CalendarTag.py, line 312, in
> render_wm
>   File d:\Program
> Files\Zope\lib\python\Products\Calendar\CalendarTag.py, line 353, in
> render_day_
>   File D:\Program Files\Zope\lib\python\DocumentTemplate\DT_Let.py,
line
> 145, in render
>     (Object: d="date.Date()"
>               hasdate="hasProperty(d)"
>               dprop="getProperty(d)")
>   File D:\Program Files\Zope\lib\python\DocumentTemplate\DT_Util.py,
> line 335, in eval
>     (Object: AUTHENTICATED_USER.has_role()=='Manager')
>     (Info: AUTHENTICATED_USER)
>   File <string>, line 0, in ?
> TypeError: (see above)
> ===============================================
>
> The Zope documentation I have says that AUTHENTICATED_USER does not
have
> any attributes.  Can anyone explain why the code works for Jon and not
> me.
>
> Thanks,
>
> Dan
>
> -------------------------------------------------
> Dan R. Schenck        mailto:schenck@posc.org
> Business Unit Manager http://www.posc.org
> POSC, Suite 275
> 10777 Westheimer
> Houston, TX 77042
>
> voice: +1 (713) 267-5166 fax: +1 (713) 784-9219
> -------------------------------------------------
>
>
>
> _______________________________________________
> 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 )
>