Re: Optional C extensions

Tim Hoffman <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
Hi

As Attila pointed out, zope.proxy is possible to implement using
peak.util.proxies
if you only want some limited zope.proxy support.  You won't get
zope.security going down
this path.

I do that specifically so that I can use zope.deferredimport on app engine.

Below is the awful hacking I do to zope.proxy.__init__ to make it
support zope.deferredimport on appengine.

Rgds

T

===========================================================


from zope.interface import moduleProvides
from zope.proxy.interfaces import IProxyIntrospection

from peak.util.proxies import ObjectProxy

class ProxyBase(ObjectProxy):
     pass

def getProxiedObject(obj):

     if hasattr(obj,'__subject__'):
         return obj.__subject__
     else:
         return obj

def removeAllProxies(obj):
    return getProxiedObject(obj)


def sameProxiedObjects(obj1,obj2):
    if getProxiedObject(obj1) == getProxiedObject(obj2):
        return True
    else:
        return False






moduleProvides(IProxyIntrospection)
__all__ = tuple(IProxyIntrospection)

def ProxyIterator(p):
    yield p
    while isProxy(p):
        p = getProxiedObject(p)
        yield p

def non_overridable(func):
    return property(lambda self: func.__get__(self))



On Wed, Mar 10, 2010 at 1:03 AM, Jim Fulton <[email protected]> wrote:
> On Tue, Mar 9, 2010 at 10:53 AM, Baiju M <[email protected]> wrote:
>> Hi,
>>   Any idea how difficult it is to create optional C extensions
>> for these packages:
>>
>> zope.container
>> zope.hookable
>> zope.proxy
>> zope.security
>
> I believe it is very hard, if not impossible, for zope.proxy and
> zope.security.  I suspect the best approach would be to make a new
> package (or set of packages) that provides everything that
> zope.security providex except the zope.security.proxy package.  If I
> were going to do that though, I would rethink the way proxies and
> checkers are managed.
>
> Jim
>
> --
> Jim Fulton
> _______________________________________________
> 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 )
>
_______________________________________________
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 )
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.