5

Is there a comprehensive reference list of the generic setup import step names?

The names of generic setup import steps don't always match the names of their corresponding xml files for example 'types.xml' has an import step called 'typeinfo'.

In the absence of a list, I would be satisfied with a simple approach to finding out the name of the import step. For example the import step name for plone.app.registry which is managed by the 'registry.xml' file is not obvious, I tried to refer to it as 'registry' but this fails, see code below:

from Products.CMFCore.utils import getToolByName
PROFILE_ID = 'profile-my.package:default'
setup = getToolByName(context, 'portal_setup')
setup.runImportStepFromProfile(PROFILE_ID, 'registry')

And the result was:

ValueError: No such import step: registry
Giacomo Spettoli
  • 4,476
  • 1
  • 16
  • 24
David Bain
  • 2,439
  • 1
  • 17
  • 19

2 Answers2

8

You should try this:

stepregistry = portal.portal_setup.getImportStepRegistry()
stepregistry.listSteps()

edit:

actually this will give you the complete list (I've tested it this time):

>>> portal.portal_setup.getSortedImportSteps()
(u'PloneSurvey_various', u'rolemap', u'sharing', u'plone-difftool',...

...and if you want more metadata use this:

>>> portal.portal_setup.getImportStepMetadata('jsregistry')
{'handler': 'Products.ResourceRegistries.exportimport.jsregistry.importJSRegistry', 'description': u'Import javascript registry', 'version': None, 'title': u'Javascript registry', 'dependencies': (u'toolset', u'componentregistry'), 'id': u'jsregistry', 'invalid': False}
Giacomo Spettoli
  • 4,476
  • 1
  • 16
  • 24
2

What I ended up doing was as follows: go into the plone/app/registry/exportimport/configure.zcml file where the name was registered as:

<gs:importStep

    name="plone.app.registry"

    title="Manage the configuration registry"

    description="Add or remove records, or change values"

    handler=".handler.importRegistry">
    <depends name="componentregistry"/>

    <depends name="toolset"/>`

</gs:importStep>`

Turns out the name of the import step was registered as 'plone.app.registry'

So basically I had to dig into the code to find out where the importStep was registered.

allcaps
  • 10,945
  • 1
  • 33
  • 54
David Bain
  • 2,439
  • 1
  • 17
  • 19