SilvaLayout IMetadata interface doesn't get metadata of versions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Silva |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The SilvaLayout views are defined on IContent and IContainer. Documents are types of IContent (IVersionedContent, to be exact). In a public view layout for a document, the "context" (or model) is the VersionedContent object (document), not the IVersion (documentversion).
When you get the metadata adapter, e.g.
from Products.
md = IMetadata(context)
You get a metadata adapter for the VersionedContent. BUT, versionedcontent objects do not store the metadata, the versions do! So the metadata values you get cannot be for the document, but for the container.
IMetadata is not registered for IVersions.
Since "context" is the document, and we can use SilvaView.
1. In Silva 3.0 if you ask the metadata of the IVersionedContent you can the metadata of the public (or next or last closed) version in read only, invalidating this issue.
2. The IMetadata adapter have already been fixed to handle this case, in 2.3.