[Zope-dev] Re: PROBLEM(100) Init Ambiguous name

Shane Hathaway shane@digicool.com
Fri, 27 Jul 2001 13:15:45 -0400


On Friday 27 July 2001 12:06, Chris Withers wrote:
> Shane Hathaway wrote:
>
> <snip>
>
> > >     manage_main = manage_editForm
> >
> > Assuming it's "manage_editForm", you would add a line like this below
> > the line you quoted:
> >
> > manage_editForm._setName("manage_editForm")
>
> Ah, okay, is it 'okay' to use _setName in the longterm?

Yes.

> What happens if I want to protect manage_editForm with one permission
> and manage_main with another?

You can't.  :-)  That's why the ambiguity is a problem.  If the method is 
called manage_editForm, the security machinery (under most circumstance) 
will look for "manage_editForm__roles__" no matter what attribute name 
you used to access it.  Maybe someday this will change.

> Also, kindof related, what happens if I want to protect a method with
> more than one permission?

You can't do that either, and for good reason.  Would it be an OR or an 
AND operation?  Or some combination?  Better to just call 
getSecurityManager().checkPermission().

Shane