通过变形驾驶变得容易!
mr.migrator的Python项目详细描述
migrator先生:通过转换驱动变得容易!
Migrator先生也是一个更具渗透性的管道管理者 通过命令行或作为plone附加组件。
- 代码库:http://github.com/collective/mr.migrator" rel="nofollow">http://github.com/collective/mr.migrator
- 对http://github.com/collective/mr.migrator/issues" rel="nofollow">http://github.com/collective/mr.migrator/issues的问题和评论
- 在http://github.com/collective/mr.migrator/issues" rel="nofollow">http://github.com/collective/mr.migrator/issues上报告错误
内容
- mr.migrator:drive by transmorgification make easy! UL>
- 简介
- 获取管道
- 构建自己的管道
- 使用注册管道
简介
transmogrifier是创建称为"管道"的转换过程的强大工具。 transmogrifier为您提供了创建和共享这些管道的工具,但没有提供 一种运行管道的简单方法。Migrator先生的目标是缩小这一差距。
migrator先生提供以下服务:
获取管道
pipeline是collective.transmogrifier中字典项通过系列的概念。 在步骤中,每个步骤向外部源添加、删除或上载信息。管道 在配置文件中使用ini样式语法进行配置。Migrator先生让你 您自己建立的管道,或
建立自己的管道
有关详细信息,请参见collective.transmogrifer 管道 。
一旦创建了pipeline.cfg,就可以在命令行上通过
migrate --pipeline=mypipeline.cfg
或者如果通过BuildOut安装
[migrate] recipe = mr.migrator pipeline = mypipeline.cfg
如果在管道中使用蓝图,则需要确保zcml配置 注册它们的程序被执行。如果您使用的是BuildOut,则可以使用以下命令
[buildout] parts += mr.migrator [migrator] recipe = mr.migrator pipeline = mypipeline.cfg eggs = transmogrify.sqlalchemy zcml = transmogrify.sqlalchemy
这将确保下载包含蓝图的包,并为其下载zcml 在管道运行之前运行,以便注册蓝图。
如果不使用buildout,则需要通过
migrate --zcml=transmogrify.sqlalchemy,transmogrify.other
如果蓝图包包含以下入口点,则可以跳过上面的zcml设置
entry-points = {"z3c.autoinclude.plugin":['target = transmogrify']}
如果使用plone插件,目前还没有运行自定义管道的方法。你会有 注册如下。
使用注册的管道
如果管道已通过zcml注册到另一个包中,例如
<configure xmlns="http://namespaces.zope.org/zope" xmlns:transmogrifier="http://namespaces.plone.org/transmogrifier" i18n_domain="collective.transmogrifier"> <transmogrifier:registerConfig name="exampleconfig" title="Example pipeline configuration" description="This is an example pipeline configuration" configuration="example.cfg" /> </configure>
并且包有一个入口点,可以加载zcml,例如
entry_points = {"z3c.autoinclude.plugin":['target = transmogrify']}
然后您可以让migrator先生通过
migrate --pipeline=exampleconfig
或
[migrate] recipe = mr.migrator pipeline = exampleconfig
声明设计为重写的管道的包的一个示例是funnelweb
覆盖管道值
管道被组织为一系列的步骤,爬行的项目通过这些步骤,然后最终 上传。每个步骤作为一个或多个配置选项,以便您可以自定义导入过程 为了你的需要。几乎所有的进口都需要某种程度的配置。
每个配置键的第一部分是步骤,例如
crawler
。第二部分是
特定步骤的配置选项。例如
url
。然后后跟=和值。
配置选项可以作为构建部分的一部分提供,例如
migrate --pipeline=mypipeline.cfg0
或者可以通过命令行覆盖相同的选项
migrate --pipeline=mypipeline.cfg1
有些选项需要在构建部分中使用多行。这些可以被覆盖 通过命令行重复相同的参数,例如
migrate --pipeline=mypipeline.cfg2
使用命令行帮助查看列表可用选项的数量
migrate --pipeline=mypipeline.cfg3
控制日志记录
通过设置调试命令行开关,可以在任何特定集合上显示其他调试输出。 例如,查看有关模板匹配失败的其他详细信息
migrate --pipeline=mypipeline.cfg4
直接使用Transmogrifier(高级)
您可能需要为您的特定 转换用例。为此,您可以扩展底层的插件 输送管道。migrator先生使用transmorifier管道来执行所需的转换和所有 命令行和配方选项指管道中的选项。
您可以通过以下命令查看管道及其所有选项
migrate --pipeline=mypipeline.cfg5
您还可以保存此管道并根据自己的需要进行自定义
migrate --pipeline=mypipeline.cfg6
定制管道允许您添加自己的个人转换 标准的migrator先生工具没有预先考虑过。
请参阅Transmorgifer文档,了解如何添加自己的蓝图或添加 已存在于您的自定义管道中。
如果您决定需要自定义管道,并且希望安装转换 使用mr.migrator或transmogrifier中尚未包含的蓝图的步骤可以包括 他们使用mr.migrator构建部分中的 eggs 选项
migrate --pipeline=mypipeline.cfg7
但是,只有当蓝图包包含以下setuptools entrypoint时,这才有效 在其 设置中。py
migrate --pipeline=mypipeline.cfg8 < div > 注
一些更具变幻莫测性的蓝图假设它们是在一个巴龙内部运行的。
进程,如
plone.app.transmogrifier
中的进程(请参见http://pypi.python.org/pypi/plone.app.transmogrifier" rel="nofollow">http://pypi.python.org/pypi/plone.app.transmogrifier)。移民先生
不在plone进程中运行,因此这些蓝图将不起作用。如果
如果你想把内容上传到plone中,你可以使用
transmogrify.ploneremote,它提供了替代实现
它将通过XML-RPC远程上传内容。
transmogrify.ploneremote
已经包含在漏斗网中
漏斗Web的默认管道使用什么。