Am Dienstag, den 07.03.2006, 12:49 +0100 schrieb Florian Lindner:
> Hello,
> I've tried from __init__ so content is self in my case (at least I think so):
> 
> from zope.app.component import site
> from zope.proxy import removeAllProxies
> 
> class Centershock(BTreeContainer, SiteManagerContainer):
>     __doc__ = ICentershock.__doc__
>     
>     implements(ICentershock)    
>         
>     def __init__(self):
>         """ Makes this object a site and add some required utitlies."""
>         bare = removeAllProxies(self)
>         sm = site.LocalSiteManager(bare)
>         self.setSiteManager(sm)
> 
> 
> That gives the wierd error:
> 
>   File "/home/florian/Zope3/src/zope/interface/adapter.py", line 481, in 
> subscribers
>     subscribers = [subscription(*objects)
>   File "/home/florian/Zope3/src/zope/app/container/contained.py", line 183, 
> in 
> dispatchToSublocations
>     for sub in subs.sublocations():
>   File "/home/florian/Zope3/src/zope/app/container/contained.py", line 214, 
> in 
> sublocations
>     for key in container:
>   File "/home/florian/Zope3/src/zope/app/container/sample.py", line 56, in 
> __iter__
>     return iter(self.__data)
> AttributeError: 'Centershock' object has no attribute '_SampleContainer__data'
> 
> 
> Any idea?

How about calling
 super(Centershock, self).__init__(*args, **kw)
But this will not work because during __init__ you have no context which
is needed by the site manager.

Try to subscribe to the ObjectAddedEvent.


-- 
Mit freundlichen Grüßen

Michael Howitz

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to