--- a/src/pyams_skin/viewlet/breadcrumb/__init__.py Sun Sep 09 11:16:35 2018 +0200
+++ b/src/pyams_skin/viewlet/breadcrumb/__init__.py Wed Sep 12 15:44:41 2018 +0200
@@ -25,7 +25,7 @@
from pyams_utils.url import absolute_url
from pyams_viewlet.viewlet import contentprovider_config, ViewContentProvider
from pyramid.location import lineage
-from zope.interface import implementer
+from zope.interface import implementer, Interface
from zope.schema.fieldproperty import FieldProperty
@@ -42,21 +42,19 @@
return absolute_url(self.context, self.request, self.view_name)
-@contentprovider_config(name='pyams.breadcrumbs', layer=IPyAMSLayer)
+@contentprovider_config(name='pyams.breadcrumbs', layer=IPyAMSLayer, view=Interface)
@template_config(template='breadcrumbs.pt', layer=IPyAMSLayer)
class BreadcrumbsContentProvider(ViewContentProvider):
"""Breadcrumbs content provider"""
@property
def items(self):
- result = []
registry = self.request.registry
- for context in lineage(self.context):
+ for context in reversed(tuple(lineage(self.context))):
item = registry.queryMultiAdapter((context, self.request, self.view), IBreadcrumbItem)
if item is None:
item = registry.queryMultiAdapter((context, self.request), IBreadcrumbItem)
- if item is None:
- item = registry.queryAdapter(context, IBreadcrumbItem)
+ if item is None:
+ item = registry.queryAdapter(context, IBreadcrumbItem)
if item is not None:
- result.insert(0, item)
- return result
+ yield item