Delegate read only Dublin Core data access to child object using Dexterity
Background: The working copy behaviour is not really supported for container types as it leads to problems copying all the ch开发者_运维百科ildren 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?
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.
精彩评论