Is there a good reference list for the names of the genericsetup import steps

隐身守侯 提交于 2019-12-10 05:20:15

问题


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

回答1:


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}



回答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.



来源:https://stackoverflow.com/questions/7821498/is-there-a-good-reference-list-for-the-names-of-the-genericsetup-import-steps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!