--- a/src/pyams_content/component/links/zmi/reverse.py Tue Jun 19 18:13:46 2018 +0200
+++ b/src/pyams_content/component/links/zmi/reverse.py Wed Jun 20 08:24:22 2018 +0200
@@ -19,6 +19,8 @@
from hypatia.interfaces import ICatalog
from pyams_content.shared.common.interfaces import IWfSharedContent
from pyams_content.shared.common.interfaces.zmi import ISiteRootDashboardTable
+from pyams_content.shared.site.interfaces import ISiteContainer
+from pyams_portal.interfaces import IPortalTemplate
from pyams_sequence.interfaces import ISequentialIdInfo
from pyams_skin.interfaces import IInnerPage
from pyams_skin.layer import IPyAMSLayer
@@ -77,11 +79,23 @@
@property
def values(self):
+
+ def get_item(result):
+ parent = get_parent(result, IWfSharedContent)
+ if parent is not None:
+ return IWorkflowVersions(parent).get_last_versions(count=1)[0]
+ parent = get_parent(result, IPortalTemplate)
+ if parent is None:
+ parent = get_parent(result, ISiteContainer)
+ if parent is None:
+ parent = self.request.root
+ return parent
+
catalog = get_utility(ICatalog)
oid = ISequentialIdInfo(self.context).hex_oid
params = Or(Eq(catalog['link_reference'], oid),
Eq(catalog['link_references'], oid))
- return unique(map(lambda x: IWorkflowVersions(get_parent(x, IWfSharedContent)).get_last_versions(count=1)[0],
+ return unique(map(get_item,
CatalogResultSet(CatalogQuery(catalog).query(params,
sort_index='modified_date'))))