[Zope-dev] Optional C extensions

Tim Hoffman zutesmog at gmail.com
Tue Mar 9 18:15:35 EST 2010


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 <jim at zope.com> wrote:
> On Tue, Mar 9, 2010 at 10:53 AM, Baiju M <mbaiju at zeomega.com> 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  -  Zope-Dev at zope.org
> 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 )
>


More information about the Zope-Dev mailing list