[Checkins] SVN: z3c.breadcrumb/trunk/ - Feature: Added ability to register a Null-adapter as a breadcrumb. A
Stephan Richter
srichter at gmail.com
Fri May 29 01:57:20 EDT 2009
Log message for revision 100526:
- Feature: Added ability to register a Null-adapter as a breadcrumb. A
null-breadcrumb will cause the item not to be displayed in the breadcrumbs.
- Get ready for release.
Changed:
U z3c.breadcrumb/trunk/CHANGES.txt
U z3c.breadcrumb/trunk/setup.py
U z3c.breadcrumb/trunk/src/z3c/breadcrumb/README.txt
U z3c.breadcrumb/trunk/src/z3c/breadcrumb/browser.py
-=-
Modified: z3c.breadcrumb/trunk/CHANGES.txt
===================================================================
--- z3c.breadcrumb/trunk/CHANGES.txt 2009-05-29 00:36:13 UTC (rev 100525)
+++ z3c.breadcrumb/trunk/CHANGES.txt 2009-05-29 05:57:19 UTC (rev 100526)
@@ -2,9 +2,11 @@
CHANGES
=======
-1.0.4 (unreleased)
+1.1.0 (2009-05-29)
+------------------
-- ...
+- Feature: Added ability to register a Null-adapter as a breadcrumb. A
+ null-breadcrumb will cause the item not to be displayed in the breadcrumbs.
1.0.3 (2008-12-13)
------------------
Modified: z3c.breadcrumb/trunk/setup.py
===================================================================
--- z3c.breadcrumb/trunk/setup.py 2009-05-29 00:36:13 UTC (rev 100525)
+++ z3c.breadcrumb/trunk/setup.py 2009-05-29 05:57:19 UTC (rev 100526)
@@ -23,7 +23,7 @@
setup (
name='z3c.breadcrumb',
- version='1.0.4dev',
+ version='1.1.0',
author = "Roger Ineichen,Stephan Richter and the Zope Community",
author_email = "zope3-dev at zope.org",
description = "A pluggable breadcrumbs implementation based on adapters.",
Modified: z3c.breadcrumb/trunk/src/z3c/breadcrumb/README.txt
===================================================================
--- z3c.breadcrumb/trunk/src/z3c/breadcrumb/README.txt 2009-05-29 00:36:13 UTC (rev 100525)
+++ z3c.breadcrumb/trunk/src/z3c/breadcrumb/README.txt 2009-05-29 05:57:19 UTC (rev 100526)
@@ -137,9 +137,9 @@
and the label ``Zope Foundation`` is collected by the custom IBreadcrumb
adapter:
- >>> breadcrumb = zope.component.getMultiAdapter((office, request),
+ >>> breadcrumbs = zope.component.getMultiAdapter((office, request),
... interfaces.IBreadcrumbs)
- >>> list(breadcrumb.crumbs)
+ >>> list(breadcrumbs.crumbs)
[{'url': 'http://127.0.0.1',
'activeURL': True,
'name': 'top'},
@@ -147,12 +147,27 @@
'activeURL': True,
'name': u'Zope Foundation'}]
- >>> breadcrumb.__parent__ is office
+ >>> breadcrumbs.__parent__ is office
True
Default breadcrumbs stops on virtual host root
-
+
>>> request._vh_root = office
- >>> list(breadcrumb.crumbs)
+ >>> list(breadcrumbs.crumbs)
[{'url': 'http://127.0.0.1', 'activeURL': True, 'name': u'Zope Foundation'}]
+If the breadcrumb of an item is a Null-adapter, then the item is ignored.
+
+ >>> from zope.traversing.interfaces import IContainmentRoot
+ >>> zope.component.provideAdapter(
+ ... lambda c, r: None,
+ ... (IContainmentRoot, IHTTPRequest),
+ ... interfaces.IBreadcrumb)
+
+ >>> request = TestRequest()
+ >>> breadcrumbs = zope.component.getMultiAdapter(
+ ... (office, request), interfaces.IBreadcrumbs)
+ >>> list(breadcrumbs.crumbs)
+ [{'url': 'http://127.0.0.1/office',
+ 'activeURL': True,
+ 'name': u'Zope Foundation'}]
Modified: z3c.breadcrumb/trunk/src/z3c/breadcrumb/browser.py
===================================================================
--- z3c.breadcrumb/trunk/src/z3c/breadcrumb/browser.py 2009-05-29 00:36:13 UTC (rev 100525)
+++ z3c.breadcrumb/trunk/src/z3c/breadcrumb/browser.py 2009-05-29 05:57:19 UTC (rev 100526)
@@ -60,8 +60,10 @@
objects.reverse()
for object in objects:
- info = zope.component.getMultiAdapter(
+ info = zope.component.queryMultiAdapter(
(object, self.request), interfaces.IBreadcrumb)
+ if info is None:
+ continue
yield {'name': info.name,
'url': info.url,
'activeURL': info.activeURL}
More information about the Checkins
mailing list