[Zope-CMF] Re: Tools as local utilities

Jens Vagelpohl jens at dataflake.org
Mon Nov 13 15:24:10 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 13 Nov 2006, at 16:22, Jens Vagelpohl wrote:
> I have to run off right now, but a quick look over GSLocalAddons  
> suggests it should be part of the main CMF Default GS profile, and  
> doing it with GenericSetup certainly is the way to go. Why did  
> Hanno not put it into the CMF base profile right from the start,  
> dangit!

So I'm currently stealing^H^H^H^H^H^H^H integrating Hanno's code from  
GSLocalAddons into CMFCore and CMFDefault. I'm running into an issue  
with the site/site manager registration, though. It does not work  
when instantiating the site, but it does when going to the setup tool  
in the newly created site afterwards and telling it to import all steps.

Analogous to the way it is done in Plone I have parked the site/site  
manager stuff in CMFDefault.setuphandlers.importVarious for now,  
which now contains code like this:

- ---------------------------------------
<snip>
from Products.Five.component import enableSite
from Products.Five.component.interfaces import IObjectManagerSite
from zope.component.globalregistry import base
from zope.component.persistentregistry import PersistentComponents
</snip>

<snip>
def importVarious(context):
     """ Import various settings.
     """
     site = context.getSite()

     # Make the portal a Zope3 site and create a site manager.
     enableSite(site, iface=IObjectManagerSite)
     components = PersistentComponents()
     components.__bases__ = (base,)
     site.setSiteManager(components)
</snip>
- ------------------------------------------

My new handler for the component registry is all set up and  
registered correctly, and the "various" import step that calls  
importVarious is set as a dependency for the component registry  
import step. The dependency works, it is indeed run right before my  
new step. However, registration fails, because a call to  
zope.app.component.hooks.getSite in my component registry setup  
handler returns None, as if the registration in importVarious had not  
been done. When re-running all steps manually from the setup tool  
afterwards it magically works and the component registry is populated...

jens



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFFWNRwRAx5nvEhZLIRAsQ6AJ4vMmGE3/KbBwMFL9LabRZ0163rOgCaAh35
lSvOhymgZOSAhbxrP4wZl9g=
=Bj8/
-----END PGP SIGNATURE-----


More information about the Zope-CMF mailing list