Hi,

My first question regarding that would be: why use zope.proxy for it.
Personally - not knowing what exactly you have in mind ofc - i'd use
something along the lines of

class Proxy(object):

    def __init__(self, obj):
        self.obj = obj

    def __getattr__(self, attribute):
        return getattr(obj, attribute)

maybe add a check of the returned attribute is callable or so.

Andreas


Andreas Jung wrote:
> Hi there,
> 
> I am trying to figure out how to use zope.proxy for creating read-only
> proxy objects of arbitrary Python objects where only attributes can be
> accessed read-only (no write access to attributes, no calling of
> methods). Anyone with some example code?
> 
> Andreas
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope )


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to