Re: getting size of zope.schema.List from a view in bluebream

Joshua Immanuel <[email protected]>
Newsgroups gmane.comp.web.zope.devel,gmane.comp.web.zope.bluebream
Organization HiPro IT Solutions Private Limited
Message-ID <1314101602.2450.111.camel@jimman>
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

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEABECAAYFAk5TmWIACgkQWw85XwuSFMJq+QCeP3oHqWJ46YLAY65P7aDoHk4a
WDQAoI2TKdpNGCIiiQyAnTBjUltnJuDL
=w5sG
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.