Look for navigation illustration in internal links
authorThierry Florac <thierry.florac@onf.fr>
Fri, 15 Jun 2018 18:19:02 +0200
changeset 695 096cfad5eeb5
parent 694 4541a452fd4c
child 703 9321e638da9b
Look for navigation illustration in internal links
src/pyams_content/features/menu/portlet/navigation/zmi/double.py
src/pyams_content/features/menu/portlet/navigation/zmi/simple.py
--- a/src/pyams_content/features/menu/portlet/navigation/zmi/double.py	Fri Jun 15 18:18:16 2018 +0200
+++ b/src/pyams_content/features/menu/portlet/navigation/zmi/double.py	Fri Jun 15 18:19:02 2018 +0200
@@ -16,10 +16,10 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.illustration.interfaces import IIllustration
+from pyams_content.component.illustration.interfaces import IIllustration, ILinkIllustration
 from pyams_content.component.links.interfaces import IInternalLink
 from pyams_content.features.menu.portlet.navigation.interfaces.double import IDoubleNavigationPortletSettings, \
-    IDoubleNavigationMenu, IDoubleNavigationMenusContainer
+    IDoubleNavigationMenusContainer
 from pyams_form.interfaces.form import IInnerSubForm
 from pyams_pagelet.interfaces import IPagelet
 from pyams_portal.interfaces import IPortletPreviewer
@@ -96,5 +96,9 @@
         if (illustration is None) or not illustration.has_data():
             if IInternalLink.providedBy(link):
                 target = link.get_target()
-                illustration = IIllustration(target)
+                if target is None:
+                    return
+                illustration = ILinkIllustration(target, None)
+                if (illustration is None) or not illustration.has_data():
+                    illustration = IIllustration(target, None)
         return illustration
--- a/src/pyams_content/features/menu/portlet/navigation/zmi/simple.py	Fri Jun 15 18:18:16 2018 +0200
+++ b/src/pyams_content/features/menu/portlet/navigation/zmi/simple.py	Fri Jun 15 18:19:02 2018 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.illustration.interfaces import IIllustration
+from pyams_content.component.illustration.interfaces import IIllustration, ILinkIllustration
 from pyams_content.component.links.interfaces import IInternalLink
 from pyams_content.features.menu.portlet.navigation.interfaces.simple import ISimpleNavigationPortletSettings, \
     ISimpleNavigationMenu
@@ -96,5 +96,9 @@
         if (illustration is None) or not illustration.has_data():
             if IInternalLink.providedBy(link):
                 target = link.get_target()
-                illustration = IIllustration(target)
+                if target is None:
+                    return
+                illustration = ILinkIllustration(target, None)
+                if (illustration is None) or not illustration.has_data():
+                    illustration = IIllustration(target, None)
         return illustration