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

Joshua Immanuel josh at hipro.co.in
Tue Aug 23 08:13:22 EDT 2011


Hello Charlie,

Thanks for the reply.

On Tue, 2011-08-23 at 13:56 +0200, Charlie Clark wrote:
> I think it's really difficult to work out what you are trying to do.  
> Please state your problem more clearly. Are you still using zope.form
> or are you using z3c.form? 

I am still using zope.formlib. I guess I found the root of the problem.
All the schema fields are security proxied I guess. Removing the
security proxy from those fields before accessing the field's inbuilt
methods solves the problem. So, my code now looks like this

        from zope.security.proxy import removeSecurityProxy
        
        sz = len(removeSecurityProxy(self.context.list_field))
        ...
        
        li = removeSecurityProxy(self.context.list_field)
        res = li[offset:limit]
        
I guess this is a cleaner approach.

Regards
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20110823/1badb04a/attachment.bin 


More information about the Zope-Dev mailing list