使用 Dexterity 将只读 Dublin Core 数据访问委托给子对象
背景:容器类型并不真正支持工作副本行为,因为它会导致复制该文件夹的所有子文件夹时出现问题。我们正在通过为容器类型使用子数据类型来解决这个问题:几乎所有有关容器的数据都存储在一个数据对象中,该数据对象是该容器及其默认视图的子对象。我们从列表和搜索中排除数据对象。
问题:这会导致不一致,目前我们必须将都柏林核心行为赋予容器类型,而不是数据类型,因为所有核心 Plone 代码都需要描述、生效日期等。这对于我们的 Plone 编辑器来说有点令人困惑,因为他们有两个地方可以编辑有关容器的数据。该数据也只能在实时版本上编辑,而不能在签出的工作副本上编辑。
我希望能够做的是:
- 将对都柏林核心数据的任何请求从容器委托给子数据对象(不知道从哪里开始)
- 在保存容器时,它将使用子数据都柏林核心数据目录中的元数据(如果第一部分正常工作,这应该可以工作)
- 在保存子数据时,它将重新索引其父对象以更新其元数据(我计划注册一个事件来实现此目的)
请有人提供我对如何首先实现这一目标有一些建议 部分?
Background: The working copy behaviour is not really supported for container types as it leads to problems copying all the children of that folder. We're working round that by using child data types for our container types: Almost all data about the container is stored in a data object that is a child object of that container and its default view. We exclude the data objects from listings and search.
Problem: This leads to an inconsistency where currently we have to give the dublin core behaviour to the container type, not the data type, because all the core Plone code expects description, effective date etc to be there. This is slightly confusing for our Plone editors as they have two places to edit data about the container. This data can also only be edited on the live version, rather than a checked out working copy.
What I'd like to be able to do is:
- delegate any requests for dublin core data from the container to the child data object (no idea where to start on this)
- on saving the container it will use the child data dublin core data for its meta data in the catalog (this should just work if the first part is working)
- on saving the child data it will reindex its parent object to update its meta data (I was planning on registering an event to achieve this)
Please can someone provide me with some pointers on how to achieve this first part?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您在这里有两个选择:
创建您自己的元数据行为来查找数据对象上的元数据。
当数据对象被修改时,只需在事件处理程序中更新父级的元数据。
鉴于您无论如何都需要事件处理程序来强制父级重新索引,我可能会采用简单的元数据复制方法。
I think you have two options here:
Make your own metadata behavior that looks up metadata on the data object.
Simply update the parent's metadata in an event handler when the data object is modified.
Given you'll need the event handler to force the parent reindex anyway, I'd probably go with the simple copying of metadata approach.