[Zope] problem testing for a permission

Dieter Maurer dieter@handshake.de
Fri, 20 Apr 2001 21:30:42 +0200 (CEST)


ethan mindlace fremen writes:
 > --On Thursday, April 19, 2001 23:01:42 +0200 Jerome Alet <alet@unice.fr> 
 > wrote:
 > > <dtml-if "AUTHENTICATED_USER.has_permission('View', mymethod)">
 > > ...
 > > but if I access the pages as an anonymous user then I've got
 > > an Unauthorized exception instead of not having the "Members only" link.
 > >
 > > What do I have done wrong ?
 > 
 > you don't want to evaluate truth: you want to see if there's an exception.
If I had the problem, I would object intensively:

  He wants to check whether the current user has 'View' permission
  for "mymethod".

  His code should always return a truth value and never raise
  an "Unauthorized" exception.

As reported in an earlier post, I cannot fully reproduce his observation.
I do not need "View" permission but I do need an
"Access Contents Information" permission.
As the code above does not access any contents of "mymethod",
this is definitely a bug. Not very serious, but nevertheless a bug...


Dieter