Re: [Zope3-Users] problem adding localsitemanager in a subscriber with 3.5dev KGS

2009-02-28 Thread Dan Korostelev
2009/2/28 Dan Korostelev nad...@gmail.com:

 changing the assignment in
 zope.site.site.changeSiteConfigurationAfterMove (line 254) to

        site.getSiteManager().__bases__ = (next, ) if next else ()

 should do it.

 Well, it should be set to global site manager instead of empty tuple,
 but it's basically like that :) I've fixed that in the trunk.

 Thanks for the report!

It's in zope.site 3.6.1 now.

-- 
WBR, Dan Korostelev
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] problem adding localsitemanager in a subscriber with 3.5dev KGS

2009-02-27 Thread Dan Korostelev
2009/2/27 Jens W. Klein j...@bluedynamics.com:
 Hi,

 I use the the KGS of zope 3.5dev (I need Python 2.6 because of third
 party code i integrate) and try to build a simple site and add a local
 component registry using a subscriber. It looks like I missed something -
 or I hit a bug in zope3.5dev. But before I report a bug I want to be sure
 that it isnt my fault.


...snip code and traceback...


 It calls the subscriber, adds the LocalSiteManager and then another event
 happens and the subscriber zope.site.site.changeSiteConfigurationAfterMove
 is called (line 251). Here is the code in there:

    if event.newParent is not None:
        next = _findNextSiteManager(site)
        site.getSiteManager().__bases__

 next is None here, so __bases__ has a None in the list.

 Btw., the way the sitemanager is added is the same as described in
 Phillip von Weiterhausens book.

 Whats wrong?

It assumes that the root folder has its own component registry, but
the rootFolder factory doesn't create one, so it returns none as the
next site manager. So, you need to call setSiteManager for the root
folder after creating it. However, I guess this case should be handled
by zope.site's event handler. I'll take a look at that tomorrow.

-- 
WBR, Dan Korostelev
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] problem adding localsitemanager in a subscriber with 3.5dev KGS

2009-02-27 Thread Jens W. Klein
Am Sat, 28 Feb 2009 00:28:38 +0300 schrieb Dan Korostelev:
[...]
 It assumes that the root folder has its own component registry, but the
 rootFolder factory doesn't create one, so it returns none as the next
 site manager. So, you need to call setSiteManager for the root folder
 after creating it. 

indeed!

   from site import MySite
   mysite = MySite()
   from zope.app.folder import rootFolder 
   root = rootFolder()
   root.setSiteManager(LocalSiteManager(root))
   root[u'mysite'] = mysite

works fine!

 However, I guess this case should be handled by
 zope.site's event handler. I'll take a look at that tomorrow.

changing the assignment in 
zope.site.site.changeSiteConfigurationAfterMove (line 254) to

site.getSiteManager().__bases__ = (next, ) if next else ()

should do it. 

Thanks a lot
-- 
Jens W. Klein, BlueDynamics Alliance, http://bluedynamics.com

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


Re: [Zope3-Users] problem adding localsitemanager in a subscriber with 3.5dev KGS

2009-02-27 Thread Dan Korostelev
2009/2/28 Jens W. Klein j...@bluedynamics.com:
 Am Sat, 28 Feb 2009 00:28:38 +0300 schrieb Dan Korostelev:
 [...]
 It assumes that the root folder has its own component registry, but the
 rootFolder factory doesn't create one, so it returns none as the next
 site manager. So, you need to call setSiteManager for the root folder
 after creating it.

 indeed!

   from site import MySite
   mysite = MySite()
   from zope.app.folder import rootFolder
   root = rootFolder()
   root.setSiteManager(LocalSiteManager(root))
   root[u'mysite'] = mysite

 works fine!

 However, I guess this case should be handled by
 zope.site's event handler. I'll take a look at that tomorrow.

 changing the assignment in
 zope.site.site.changeSiteConfigurationAfterMove (line 254) to

        site.getSiteManager().__bases__ = (next, ) if next else ()

 should do it.

Well, it should be set to global site manager instead of empty tuple,
but it's basically like that :) I've fixed that in the trunk.

Thanks for the report!

-- 
WBR, Dan Korostelev
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users