Re: [Zope-CMF] GenericSetup and PluggableAuthService
-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
Re: [Zope-CMF] GenericSetup and PluggableAuthService
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tres Seaver wrote: > Hanno Schlichting wrote: >> And then adjust exportComponentRegistry in a similar way. This is >> untested code :) > > Why would a PAS plugin do such a thing? PAS doesn't expect (or want) > any local / persistent component registry. This issue (steps showing up > in inappropriate profiles) was the reason for the step registries being > part of a profile, and why I argued (unsuccessfully) against their > deprecation way back when: I would have preferred fixing whatever > issues existesd, over using a "global" stop registry. That particular question, why the PAS import/export routine would try to run those CMF steps, was exactly what I thought when I tried it all out. I do remember that GS design discussion vaguely but never paid much attention because I never used GS "in anger" and outside of the CMF. It's not my goal to reopen that argument, but I'm left with the impression that at least from the perspective of someone who uses the setuptool ZMI to explore and use GS there are some expectation mismatches and usability problems. Once you recognize the design decision you can at least explain the behavior. I'll continue down the path of trying to make the steps themselves more resilient so I get somewhere. At some later date it may be useful to review the current behavior. I feel some decisions may have been taken with a too-narrow focus (CMF only) because very few people use GS outside of the CMF or Plone. jens -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAks8g3UACgkQRAx5nvEhZLKxBQCeKGBzWK/PO1Auo5DjsuLORkqm VWIAn0r8IIjsQoEre4WNE+lGZBwBm6re =vqt/ -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
Re: [Zope-CMF] GenericSetup and PluggableAuthService
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hanno Schlichting wrote: > On Wed, Dec 30, 2009 at 4:19 PM, Jens Vagelpohl wrote: >> In the debugger I see that the object in question is a absolute_url >> adapter residing in the base component registry in the site root. IMHO >> the components exporter should not look at the base registry at all, >> only a local registry if one exists in the folder the tool sits in. Correct? > > Right. As you noticed nobody ever tried to use GS outside a CMF/Plone context > :) Not quite: I have made heavy use of it for migrating PAS configurations separately from any other site config. > The code in question does a: > > sm = getSiteManager(context.getSite()) > > That will get the nearest site manager, which in case of CMF will > always be the one in the CMF site root. > > 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 > > if sm is None or not IComponentRegistry.providedBy(sm): > logger = context.getLogger('componentregistry') > logger.info("Can not register components, as no registry was found.") > return > > importer = queryMultiAdapter((sm, context), IBody) > if importer: > body = context.readDataFile('componentregistry.xml') > if body is not None: > importer.body = body > > > And then adjust exportComponentRegistry in a similar way. This is > untested code :) Why would a PAS plugin do such a thing? PAS doesn't expect (or want) any local / persistent component registry. This issue (steps showing up in inappropriate profiles) was the reason for the step registries being part of a profile, and why I argued (unsuccessfully) against their deprecation way back when: I would have preferred fixing whatever issues existesd, over using a "global" stop registry. 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 iEYEARECAAYFAks71woACgkQ+gerLs4ltQ529ACgwT7S2I7gAeb69hFOqjhTDxNP IMwAniF83Usoz4CPoFX/37/nsOUT+wr1 =Ni96 -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
Re: [Zope-CMF] GenericSetup and PluggableAuthService
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Wichert Akkerman wrote: > On 2009-12-30 16:19, Jens Vagelpohl wrote: >> However, even that >> registration by interface for profiles isn't considered in the ZMI in >> the base profile or extension profile select lists that show up on the >> Profiles and Import ZMI tabs. > > That's probably a bug that should be fixed. Is there a ticket for that > in launchpad? https://bugs.launchpad.net/zope-cmf/+bug/501668 jens -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAks7eBsACgkQRAx5nvEhZLJRKQCeJO9cW2V9NZDW86WMz5Io9brf rMEAn1x4j5oDpYF0AN7uSmn914nknzEP =hpgx -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
Re: [Zope-CMF] GenericSetup and PluggableAuthService
On Wed, Dec 30, 2009 at 4:19 PM, Jens Vagelpohl wrote: > In the debugger I see that the object in question is a absolute_url > adapter residing in the base component registry in the site root. IMHO > the components exporter should not look at the base registry at all, > only a local registry if one exists in the folder the tool sits in. Correct? Right. As you noticed nobody ever tried to use GS outside a CMF/Plone context :) The code in question does a: sm = getSiteManager(context.getSite()) That will get the nearest site manager, which in case of CMF will always be the one in the CMF site root. 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 if sm is None or not IComponentRegistry.providedBy(sm): logger = context.getLogger('componentregistry') logger.info("Can not register components, as no registry was found.") return importer = queryMultiAdapter((sm, context), IBody) if importer: body = context.readDataFile('componentregistry.xml') if body is not None: importer.body = body And then adjust exportComponentRegistry in a similar way. This is untested code :) Hanno ___ 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
Re: [Zope-CMF] GenericSetup and PluggableAuthService
On 2009-12-30 16:19, Jens Vagelpohl wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Wichert Akkerman wrote: >> On 2009-12-30 15:35, Jens Vagelpohl wrote: >>> The reason I thought this list of steps may (should?) change is that for >>> example the PluggableAuthService profiles (both of which are BASE >>> profiles) explicitly define what steps they provide with an >>> import_steps.xml and export_steps.xml file. My assumption was that if >>> you have one of the PAS profiles set as the baseline profile, and then >>> select "Current base profile" on the Import tab, then the list of steps >>> would reflect what the PAS profile import_steps.xml contains. >> >> I am wondering if the CMFCore import/export steps are registered for >> Interface instead of ISiteRoot? You should only see steps that are >> registered for the current context, and since a PAS user folder is not >> an ISiteRoot the CMF import and export steps should not show up or be run. > > Looking at the code it appears steps (import and export) are not > registered for interfaces. Only profiles are. Indeed, I remembered that incorrectly. Perhaps that would be a useful extension at some point. > However, even that > registration by interface for profiles isn't considered in the ZMI in > the base profile or extension profile select lists that show up on the > Profiles and Import ZMI tabs. That's probably a bug that should be fixed. Is there a ticket for that in launchpad? > I have now gotten things to work by going through all import handlers in > CMFCore and making sure they don't do anything if their handled content > does not exist. Some already failed gracefully, others didn't. Looks > like a simple oversight and lack of usage outside of the CMF. Great! > Another item that does not work is the Snapshot tab and the export of > all steps when inside the PluggableAuthService instance. The failure > looks like this: > > Traceback (innermost last): >Module ZPublisher.Publish, line 127, in publish >Module ZPublisher.mapply, line 77, in mapply >Module ZPublisher.Publish, line 47, in call_object >Module Products.GenericSetup.tool, line 586, in manage_exportAllSteps >Module Products.GenericSetup.tool, line 351, in runAllExportSteps >Module Products.GenericSetup.tool, line 1022, in _doRunExportSteps >Module Products.GenericSetup.components, line 530, in > exportComponentRegistry >Module Products.GenericSetup.utils, line 495, in _exportBody >Module Products.GenericSetup.components, line 63, in _exportNode >Module Products.GenericSetup.components, line 373, in _extractAdapters >Module Products.GenericSetup.utils, line 72, in _getDottedName > ValueError: Cannot compute dotted name: object at 0x10471b550> > > In the debugger I see that the object in question is a absolute_url > adapter residing in the base component registry in the site root. IMHO > the components exporter should not look at the base registry at all, > only a local registry if one exists in the folder the tool sits in. Correct? I'ld say so, yes. Wichert. -- Wichert AkkermanIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. ___ 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
Re: [Zope-CMF] GenericSetup and PluggableAuthService
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Wichert Akkerman wrote: > On 2009-12-30 15:35, Jens Vagelpohl wrote: >> The reason I thought this list of steps may (should?) change is that for >> example the PluggableAuthService profiles (both of which are BASE >> profiles) explicitly define what steps they provide with an >> import_steps.xml and export_steps.xml file. My assumption was that if >> you have one of the PAS profiles set as the baseline profile, and then >> select "Current base profile" on the Import tab, then the list of steps >> would reflect what the PAS profile import_steps.xml contains. > > I am wondering if the CMFCore import/export steps are registered for > Interface instead of ISiteRoot? You should only see steps that are > registered for the current context, and since a PAS user folder is not > an ISiteRoot the CMF import and export steps should not show up or be run. Looking at the code it appears steps (import and export) are not registered for interfaces. Only profiles are. However, even that registration by interface for profiles isn't considered in the ZMI in the base profile or extension profile select lists that show up on the Profiles and Import ZMI tabs. I have now gotten things to work by going through all import handlers in CMFCore and making sure they don't do anything if their handled content does not exist. Some already failed gracefully, others didn't. Looks like a simple oversight and lack of usage outside of the CMF. Another item that does not work is the Snapshot tab and the export of all steps when inside the PluggableAuthService instance. The failure looks like this: Traceback (innermost last): Module ZPublisher.Publish, line 127, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 47, in call_object Module Products.GenericSetup.tool, line 586, in manage_exportAllSteps Module Products.GenericSetup.tool, line 351, in runAllExportSteps Module Products.GenericSetup.tool, line 1022, in _doRunExportSteps Module Products.GenericSetup.components, line 530, in exportComponentRegistry Module Products.GenericSetup.utils, line 495, in _exportBody Module Products.GenericSetup.components, line 63, in _exportNode Module Products.GenericSetup.components, line 373, in _extractAdapters Module Products.GenericSetup.utils, line 72, in _getDottedName ValueError: Cannot compute dotted name: In the debugger I see that the object in question is a absolute_url adapter residing in the base component registry in the site root. IMHO the components exporter should not look at the base registry at all, only a local registry if one exists in the folder the tool sits in. Correct? jens -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAks7b3MACgkQRAx5nvEhZLLoVACgr9wNv68luLJ0OPt/Sg5tLprN FPYAmweOR7V3LpPng+7vUiEgMPNCodo/ =6MvA -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
Re: [Zope-CMF] GenericSetup and PluggableAuthService
On 2009-12-30 15:35, Jens Vagelpohl wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Wichert Akkerman wrote: >> On 2009-12-30 15:06, Jens Vagelpohl wrote: >>> Separate note: On the "Import" tab I see a dropdown of extension >>> profiles to select. Changing the selection here never affects the list >>> of available import steps, though. This is confusing to me, but I may >>> have misunderstood the purpose. >> >> The list of import steps is global and not per-profile, so that is >> expected behaviour. For most profiles only a few import steps do any >> real work, but the setup tool has no way to detect that so all steps are >> always listed. > > The reason I thought this list of steps may (should?) change is that for > example the PluggableAuthService profiles (both of which are BASE > profiles) explicitly define what steps they provide with an > import_steps.xml and export_steps.xml file. My assumption was that if > you have one of the PAS profiles set as the baseline profile, and then > select "Current base profile" on the Import tab, then the list of steps > would reflect what the PAS profile import_steps.xml contains. import_steps.xml and export_steps.xml were deprecated a while ago since they caused very confusing behaviour: they were loaded when a profile was activated, but they were loaded into a global registry of known steps. The result was that the list of steps could randomly change depending on which profiles you had looked at in the ZMI. In order to simplify things those two files were replaced with zcml directives. I am wondering if the CMFCore import/export steps are registered for Interface instead of ISiteRoot? You should only see steps that are registered for the current context, and since a PAS user folder is not an ISiteRoot the CMF import and export steps should not show up or be run. Wichert. -- Wichert AkkermanIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. ___ 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
Re: [Zope-CMF] GenericSetup and PluggableAuthService
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Wichert Akkerman wrote: > On 2009-12-30 15:06, Jens Vagelpohl wrote: >> Separate note: On the "Import" tab I see a dropdown of extension >> profiles to select. Changing the selection here never affects the list >> of available import steps, though. This is confusing to me, but I may >> have misunderstood the purpose. > > The list of import steps is global and not per-profile, so that is > expected behaviour. For most profiles only a few import steps do any > real work, but the setup tool has no way to detect that so all steps are > always listed. The reason I thought this list of steps may (should?) change is that for example the PluggableAuthService profiles (both of which are BASE profiles) explicitly define what steps they provide with an import_steps.xml and export_steps.xml file. My assumption was that if you have one of the PAS profiles set as the baseline profile, and then select "Current base profile" on the Import tab, then the list of steps would reflect what the PAS profile import_steps.xml contains. jens -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAks7ZTIACgkQRAx5nvEhZLJzJACeJlR4VP+XWDlDPR3Nt0FAXeIv 3icAn2nkWOVV+vou8H7xDE7EDB89xfUv =0wEG -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
Re: [Zope-CMF] GenericSetup and PluggableAuthService
On 2009-12-30 15:06, Jens Vagelpohl wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi all, > > I'm working on a PAS plugin and want to ensure it has GenericSetup > support like the standard plugins. I'm running into issues trying to use > GenericSetup in a manual test, though. > > With a setup_tool inside the PluggableAuthService instance I can create > an export tarball when I select the "Contents: Export the PAS' registry > and plugins" step explicitly and click "Export selected steps". However, > I can't find a way to re-import this tarball. > > Separate note: On the "Import" tab I see a dropdown of extension > profiles to select. Changing the selection here never affects the list > of available import steps, though. This is confusing to me, but I may > have misunderstood the purpose. > > So I am selecting my tarball into the upload field and click "Import > uploaded tarball", which presents this traceback: > > Traceback (innermost last): >Module ZPublisher.Publish, line 127, in publish >Module ZPublisher.mapply, line 77, in mapply >Module ZPublisher.Publish, line 47, in call_object >Module Products.GenericSetup.tool, line 558, in manage_importTarball >Module Products.GenericSetup.tool, line 331, in > runAllImportStepsFromProfile >Module Products.GenericSetup.tool, line 1085, in > _runImportStepsFromContext >Module Products.GenericSetup.tool, line 999, in _doRunImportStep > - __traceback_info__: catalog >Module Products.CMFCore.exportimport.catalog, line 28, in > importCatalogTool >Module Products.CMFCore.utils, line 123, in getToolByName > AttributeError: portal_catalog I think that is a bug in importCatalogTool; it should not do anything if portal_catalog does not exist. I'm a bit surprised it tries to do anything at all; do you have a catalog.xml file in your profile perhaps? Wichert. -- Wichert AkkermanIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. ___ 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
Re: [Zope-CMF] GenericSetup and PluggableAuthService
On 2009-12-30 15:06, Jens Vagelpohl wrote: > Separate note: On the "Import" tab I see a dropdown of extension > profiles to select. Changing the selection here never affects the list > of available import steps, though. This is confusing to me, but I may > have misunderstood the purpose. The list of import steps is global and not per-profile, so that is expected behaviour. For most profiles only a few import steps do any real work, but the setup tool has no way to detect that so all steps are always listed. Wichert. -- Wichert AkkermanIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. ___ 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
[Zope-CMF] GenericSetup and PluggableAuthService
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, I'm working on a PAS plugin and want to ensure it has GenericSetup support like the standard plugins. I'm running into issues trying to use GenericSetup in a manual test, though. With a setup_tool inside the PluggableAuthService instance I can create an export tarball when I select the "Contents: Export the PAS' registry and plugins" step explicitly and click "Export selected steps". However, I can't find a way to re-import this tarball. Separate note: On the "Import" tab I see a dropdown of extension profiles to select. Changing the selection here never affects the list of available import steps, though. This is confusing to me, but I may have misunderstood the purpose. So I am selecting my tarball into the upload field and click "Import uploaded tarball", which presents this traceback: Traceback (innermost last): Module ZPublisher.Publish, line 127, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 47, in call_object Module Products.GenericSetup.tool, line 558, in manage_importTarball Module Products.GenericSetup.tool, line 331, in runAllImportStepsFromProfile Module Products.GenericSetup.tool, line 1085, in _runImportStepsFromContext Module Products.GenericSetup.tool, line 999, in _doRunImportStep - __traceback_info__: catalog Module Products.CMFCore.exportimport.catalog, line 28, in importCatalogTool Module Products.CMFCore.utils, line 123, in getToolByName AttributeError: portal_catalog It is obviously trying to run an import step that's not suitable outside of a CMF site. This leaves a few questions: - Is my expectation that the tool work outside of a CMF site reasonable? - If it is, then why do I always see the full set of all registered steps from all profiles on the Import/Export ZMI tabs regardless of chosen base or extension profile? - Why is the tarball import trying to run all steps without considering the selected profile? - Are import/export steps that don't guard against missing content (such as the "catalog" step that blows up when there is no portal_catalog) just faulty and should fail silently instead? Any help appreciated :-) jens -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAks7Xl0ACgkQRAx5nvEhZLIRqwCfULJmMKsYAzU9vey+dmNg+zBN BhIAoI8UqhW3sfV13pv24i10D0b+z0jC =u+5W -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