-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Chris Withers wrote: > Hi All, > > What's the "correct" way to provide utilities in BFG imperatively? > > My guess would be: > > from repoze.bfg.configuration import Configurator > from somewhere import ISomething > from zope.component import provideUtility > > def factory(): > return ...yada... > > def app(global_config, **settings): > config = Configurator(settings=settings) > config.begin() > ...yada... > provideUtility(factory(),ISomething) > config.scan() > config.end() > return config.make_wsgi_app() > > ...or do I have to do something to make sure I register in the right > registry?
Use 'config.registry.registerUtility(factory(), ISomething)'. The "global" API of zope.component won't work unless you hook the ZCA first. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkvZnogACgkQ+gerLs4ltQ4H1wCeJ47TXz12ZKX55GioXGj6QgR4 JQ0Anii6+jL8aHkgGpHNJmC6pfML6x1h =hJaF -----END PGP SIGNATURE----- _______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev