I am a !...@head ;-)
Forgot the else: clause in the code I posted. Corrected code is below.


On Thu, Aug 13, 2009 at 11:30 AM, Tim Hoffman <t...@zute.net> wrote:

> Hi Folks
> This is a quick and dirty change and to be honest the main reason I am
> posting it here is so there is a searchable record
> for anyone else who wants to use zope.deferredimport under google app
> engine.  (With some content models
> zope.deferredimport is a great way of dealing with cyclic dependancies and
> possibly improving startup times - see bottom of this email.)
> Below is a minimal set of changes to zope.proxy.__init__  that is required
> so that zope.deferredimport can be used.
> It does mean you need peak.utils to implement a basic proxy.

incorrect code shown,

Should have read


    from zope.proxy._zope_proxy_proxy import *
    from zope.proxy._zope_proxy_proxy import _CAPI

except NotImplementedError:


    from peak.util.proxies import ObjectProxy

    class ProxyBase(ObjectProxy):

    def getProxiedObject(obj):

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

    def removeAllProxies(obj):
        return getProxiedObject(obj)

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

> There are a couple of other zope.proxy functions from the 'c' api that I
> haven't looked at yet as they aren't used by zope.deferredimport.
> Suggestions on improving it and/or followups on the other functions would
> also be welcome.  I have also found that deferred import can help
> with app engine startup times as it means you can import a module you
> depend on but not really import the code until it gets touched
> which can allow you to stagger you startup costs. (For instance edit
> functionality of a site could be deferred until someone
> actually edits something).
> Hope this helps someone
> Regards
> Tim Hoffman
Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to