-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hanno Schlichting wrote: > What you want is probably something like this: > > from zope.component.interfaces import ComponentLookupError > from zope.component.interfaces import IComponentRegistry > from zope.location.interfaces import IPossibleSite > > def importComponentRegistry(context): > """Import local components. > """ > # context is the portal_setup tool > # getSite is GS API to get the parent > site = context.getSite() > sm = None > if IPossibleSite.providedBy(site): > # All object managers are an IPossibleSite, but this > # defines the getSiteManager method to be available > try: > sm = site.getSiteManager() > except ComponentLookupError: > sm = None
This works like a treat and I used it for import and export. Afterwards I needed to adjust the component import/export test harness a lttle bit so the call to "site.getSiteManager" would not blow up because the site in those tests is a PersistentComponents instance itself. Now I can use all functions in the ZMI, including snapshots, for a PluggableAuthService. jens -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAks8klcACgkQRAx5nvEhZLIoggCgsa4dX3RxALxrC6TpHfm1pPsx bUUAniHJlrSWNMMleUb2ShDzvRFVWESD =UWLN -----END PGP SIGNATURE----- _______________________________________________ Zope-CMF maillist - Zope-CMF@zope.org https://mail.zope.org/mailman/listinfo/zope-cmf See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests