[Zope] AUTHENTICATED_USER Question

schenck schenck@ultra.posc.org
Mon, 24 Jan 2000 15:53:33 -0600


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