[Zope-CMF] Re: Tools as local utilities
Tres Seaver
tseaver at palladion.com
Mon Nov 13 16:35:24 EST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jens Vagelpohl wrote:
>
> 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...
Perhaps the thread-local site hook needs to be set first, before trying
to use the site manager?
Tres.
- --
===================================================================
Tres Seaver +1 202-558-7113 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFWOUc+gerLs4ltQ4RAlBLAKCcQM79BBflqlw332vwQcW4I5Pc8gCcDsXB
SaBgDJmEojH4z7pljPBGR5Y=
=ogeW
-----END PGP SIGNATURE-----
More information about the Zope-CMF
mailing list