SilvaLayout IMetadata interface doesn't get metadata of versions

Bug #246258 reported by Andy Altepeter
2
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.SilvaLayout.interfaces import IMetadata
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.is_preview_view to determine which version to adapt, I propose SilvaView should have a get_metadata_adapter method which retrieves an IMetadata adapter for the the correct version (if IVersionedContent), or just for the context.

Revision history for this message
Sylvain Viollon (thefunny) wrote :

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.

Changed in silva:
milestone: none → 2.3.6
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.