[PEAK] peak.security: permissionFor problem

Radek Kanovsky rk at dat.cz
Fri Feb 11 13:09:34 EST 2005


On Fri, Feb 11, 2005 at 06:43:10PM +0100, Radek Kanovsky wrote:

> > I wish you could send me a reproducable case, I have lots of things I'd 
> > like to check.
> 
> I have finally succeeded. The attached code raises AM exception on my
> computer. Code is as minimal as was possible and is very fragile.

Better one. If I remove A, B or C class, the exception is not thrown.


from peak.api import *
import peak.web.api

class A (object) :
    binding.metadata(security.Anybody)

class B (object) :
    binding.metadata(security.Anybody)

class C (object) :
    binding.metadata(security.Anybody)


policy = web.InteractionPolicy()

obj = web.Location()
print policy.permissionFor(obj,'users')

obj = web.ResourceDirectory()
print policy.permissionFor(obj,'user_list.pwt')

obj = web.TemplateDocument()
print policy.permissionFor(obj,None)

obj = web.Context('name', None, {})
try :
    perm = policy.permissionFor(obj,'user')
except dispatch.AmbiguousMethod, am :
    g = am.args[0]
    assert len(g) == 3
    assert g[0][0] is g[1][0] is g[2][0]
    assert g[0][1] is g[1][1] is g[2][1]
    raise



More information about the PEAK mailing list