[BlueBream] [Zope-dev] getting size of zope.schema.List from a view in bluebream

Adam GROSZER agroszer.ll at gmail.com
Tue Aug 23 09:13:27 EDT 2011


Hello,

<class class="persistent.list.PersistentList">
    <allow attributes="__getitem__ __getslice__ __len__ __iter__
                       __contains__ index count data" />
</class>

Should do it. (but beware I did not test!)

That is in zope.app.security/_protections.zcml

Might be that you'd need to include that package.

On Tue, 23 Aug 2011 18:30:39 +0530 you wrote:
>
> Hello Adam,
>
> Thanks for the reply.
>
> On Tue, 2011-08-23 at 14:39 +0200, Adam GROSZER wrote:
>> Well using removeSecurityProxy is not so nice.
>>
>> If there's really a list in your property, then zope should give you
>> zope.Public access:
>>
>> _default_checkers = {
>> ...
>>       list: NamesChecker(['__getitem__', '__getslice__', '__len__',
>> '__iter__',
>>                           '__contains__', 'index', 'count', '__str__',
>>                           '__add__', '__radd__', ]),
>> ...
>>
>> Can you do:
>>
>>             from zope.security.proxy import removeSecurityProxy
>>
>>             li = removeSecurityProxy(self.context.list_field)
>>            print type(li)
>
> As I am using the persistent List in the implementation of IMyObject,
> the output of the above is
>
>          <class 'persistent.list.PersistentList'>
>
> So, How can I access its inbuilt methods without removing the security
> proxy. Please guide me.
>
> Regards
>
>
>
> _______________________________________________
> bluebream mailing list
> bluebream at zope.org
> https://mail.zope.org/mailman/listinfo/bluebream


-- 
Best regards,
  Adam GROSZER
--
Quote of the day:
In my walks, every man I meet is my superior in some way, and in that I 
learn from him.
- Ralph Waldo Emerson


More information about the bluebream mailing list