[Zope3-Users] Security declarations on OOBTreeItems

hass hassan at dc4.so-net.ne.jp
Thu Apr 1 10:53:19 EDT 2010


Marius Gedminas wrote:
> On Thu, Apr 01, 2010 at 12:34:03AM +0900, hass wrote:
>   
>> I'm experiencing a problem with security declarations in OOBTreeItems.
>> The following setting which used to worked with an older version of 
>> zope.security failed after upgrading to 3.7.2.
>>     
>
> What version did you use before?
>
> <...snip...>
>   
>> the error occurs in a view when I try to see if a filename is already in 
>> self.context.keys():
>> ------------------
>>   File "pdfprofile/browser.py", line 151, in extractData
>>     if data['filename'] in self.context.keys():
>> ForbiddenAttribute: ('__contains__', <OOBTreeItems object at 0xb71c7570>)
>>     
>
> You could use
>
>       if data['filename'] in self.context:
>
> instead, and avoid the OOBTreeItems completely.
>   

Well, I was using 3.5.0 before but that doesn't seem to be the issue 
because when I check the older version, it didn't declare any permission 
for OOBTreeItems as well. The thing is that I updated my whole 
repository to the latest versions, so its really hard to figure out what 
has caused this change of behavior across versions.

>   
>> Now I believe I have correct declarations on the self.context. The 
>> problem only arises when I try to look inside the self.context.keys() 
>> which is a OOBTreeItems object.
>>
>> When I try to check the security declarations, I get an empty list 
>> meaning no declarations at all.
>>     
>
> I don't think I remember zope.security (and zope.app.security before
> that) ever declaring permissions for OOBTreeItems...
>
>   
>>  >>from zope.security.proxy import getTestProxyItems
>>  >>getTestProxyItems(self.context.keys())
>>  >>[]
>>
>> Do I have to declare them myself? shouldn't these declarations come as 
>> default?
>>     
>
> Good question.  I don't see why not.
>
>   
My problem was solved by using  "if 'something' in self.context" instead 
of "if 'something' in self.context.key()".
Thanks alot! But is there basically no other standard use-case scenario 
of OOBtreeItems imaginable?
Is that why the declarations are not being made by default? just wondering.

Thanks again!
Hass
> Regards,
> Marius Gedminas
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> https://mail.zope.org/mailman/listinfo/zope3-users
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20100401/e71772ae/attachment.html 


More information about the Zope3-users mailing list