[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/TraversalViews - AbsoluteURL.py:1.3
Jim Fulton
jim@zope.com
Thu, 11 Jul 2002 15:33:58 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/TraversalViews
In directory cvs.zope.org:/tmp/cvs-serv27871/lib/python/Zope/App/ZopePublication/TraversalViews
Modified Files:
AbsoluteURL.py
Log Message:
added breadcrumbs :)
=== Zope3/lib/python/Zope/App/ZopePublication/TraversalViews/AbsoluteURL.py 1.2 => 1.3 ===
"""Get a string representation
"""
+
class AbsoluteURL(BrowserView):
def __str__(self):
@@ -51,6 +52,19 @@
__call__ = __str__
+ def breadcrumbs(self):
+ context = self.context
+ dict = getInnerWrapperData(context)
+ name = dict and dict.get('name') or None
+ container = getWrapperContainer(context)
+ if name is None or container is None:
+ raise TypeError, 'Not enough context information to get a URL'
+
+ base = getView(container, 'absolute_url', self.request).breadcrumbs()
+ base += ({'name': name, 'url': ("%s/%s" % (base[-1]['url'], name))}, )
+ return base
+
+
class SiteAbsoluteURL(BrowserView):
@@ -58,3 +72,8 @@
return self.request.getApplicationURL()
__call__ = __str__
+
+ def breadcrumbs(self):
+ return ({'name':'', 'url': self.request.getApplicationURL()}, )
+
+