[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/TraversalViews - AbsoluteURL.py:1.4
Jim Fulton
jim@zope.com
Fri, 12 Jul 2002 15:29:05 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/TraversalViews
In directory cvs.zope.org:/tmp/cvs-serv21500/lib/python/Zope/App/ZopePublication/TraversalViews
Modified Files:
AbsoluteURL.py
Log Message:
Finally added a configuration directive for registering traversal
namespace handlers:
<traversalNamespace name="etc" handler=".EtcNamespace.etc" />
Added a "skin" namespace so you can play with Sidbei's new UI work
by adding ++skin++ZopeTop to the front of your URLs:
http://localhost:8080/++skin++ZopeTop
Added some needed __init__ modules to some of the new ZopeTop packages
and fixed up ZopeTop configure.zcml.
=== Zope3/lib/python/Zope/App/ZopePublication/TraversalViews/AbsoluteURL.py 1.3 => 1.4 ===
container = getWrapperContainer(context)
if name is None or container is None:
raise TypeError, 'Not enough context information to get a URL'
+ if name == '.':
+ name = dict.get('uri_segment', name)
return "%s/%s" % (getView(container, 'absolute_url', self.request),
name)
@@ -59,6 +61,8 @@
container = getWrapperContainer(context)
if name is None or container is None:
raise TypeError, 'Not enough context information to get a URL'
+ if name == '.':
+ name = dict.get('uri_segment', name)
base = getView(container, 'absolute_url', self.request).breadcrumbs()
base += ({'name': name, 'url': ("%s/%s" % (base[-1]['url'], name))}, )
@@ -69,11 +73,34 @@
class SiteAbsoluteURL(BrowserView):
def __str__(self):
+ context = self.context
+ dict = getInnerWrapperData(context)
+ name = dict and dict.get('name') or None
+ if name:
+ if name == '.':
+ name = dict.get('uri_segment', name)
+ container = getWrapperContainer(context)
+ return "%s/%s" % (getView(container, 'absolute_url', self.request),
+ name)
+
return self.request.getApplicationURL()
__call__ = __str__
def breadcrumbs(self):
+ context = self.context
+ dict = getInnerWrapperData(context)
+ name = dict and dict.get('name') or None
+ if name:
+ if name == '.':
+ name = dict.get('uri_segment', name)
+ container = getWrapperContainer(context)
+ base = getView(container, 'absolute_url',
+ self.request).breadcrumbs()
+ base += ({'name': name,
+ 'url': ("%s/%s" % (base[-1]['url'], name))}, )
+ return base
+
return ({'name':'', 'url': self.request.getApplicationURL()}, )