使用 quintagroup.transmogrifier 通用设置导入设置默认页面不灵巧
我们使用 quintagroup.transmogrifier 内容导入配置文件来加载自动化测试的内容(非常有用)。设置默认页面似乎不起作用。
文档建议 quintagroup.transmogrifier 支持设置默认页面,但不支持通用设置导入步骤。我最终发现您需要将一个properties.xml文件添加到文件夹项目的文件夹中,其中包含以下内容:
<?xml version="1.0" encoding="utf-8"?>
<properties>
<property name="default_page" type="string">
index
</property>
</properties>
其中index被默认页面的id替换,并且也在您需要的import.cfg中
[transmogrifier]
pipeline =
reader
…
propertiesimporter
[reader]
…
.properties.xml = propertymanager
[propertiesimporter]
blueprint = quintagroup.transmogrifier.propertiesimporter
但是这不起作用。我们正在运行 Plone 4.1rc3 + Dexterity 1.0,可能它与 Dexterity 不兼容。我已经在 quintagroup.transmogrifier.propertymanager.PropertiesImporterSection 中找到了它失败的部分代码:
path = item[pathkey]
obj = self.context.unrestrictedTraverse(path, None)
Here path 是一个 unicode 字符串,unrestrictedTraverse 返回 None 。如果您使用字节字符串,那么它会返回正确的对象。这是与敏捷不兼容还是我做错了什么?
We're using a quintagroup.transmogrifier content import profile to load content for our automated tests (very useful). Setting the default page doesn't seem to work.
The docs suggest quintagroup.transmogrifier supports setting default pages but not whether it does for generic set-up import steps. I eventually figured out you need to add a properties.xml file into the folder of the folderish item with the following:
<?xml version="1.0" encoding="utf-8"?>
<properties>
<property name="default_page" type="string">
index
</property>
</properties>
where index is replaced by the id of the default page and also in your import.cfg you need
[transmogrifier]
pipeline =
reader
…
propertiesimporter
[reader]
…
.properties.xml = propertymanager
[propertiesimporter]
blueprint = quintagroup.transmogrifier.propertiesimporter
However this doesn't work. We're running Plone 4.1rc3 + Dexterity 1.0 and presumably it's not compatible with Dexterity. I've tracked down the bit of code in quintagroup.transmogrifier.propertymanager.PropertiesImporterSection where it is falling down:
path = item[pathkey]
obj = self.context.unrestrictedTraverse(path, None)
Here path is a unicode string and unrestrictedTraverse returns None. If you use a byte string then it returns the correct object. Is this an incompatibility with Dexterity or am I doing something wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个错误,您需要向 quintagroup.transmogrifier 包的作者报告。路径必须始终是 ASCII 字节字符串,而不是 Unicode 对象。 Collective.transmogrifier(quintagroup.transmogrifier 使用的底层引擎)中的所有部分都将路径编码为 ASCII。
这是来自 collective.transmogrifier.sections.constructor 例如:
将其报告给Plone.org 上的专用问题跟踪器,以便作者可以为您修复它。
This is a bug you'll need to report with the authors of the quintagroup.transmogrifier package. Paths must always be ASCII bytestrings, not Unicode objects. All sections in collective.transmogrifier (the underlying engine that quintagroup.transmogrifier uses) encode paths to ASCII.
Here is a code snippet from collective.transmogrifier.sections.constructor for example:
Report it to the dedicated issue tracker on Plone.org so the authors can fix it for you.