[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/TraversalViews - AbsoluteURL.py:1.5
Jim Fulton
jim@zope.com
Sat, 13 Jul 2002 10:19:07 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/TraversalViews
In directory cvs.zope.org:/tmp/cvs-serv1111/lib/python/Zope/App/ZopePublication/TraversalViews
Modified Files:
AbsoluteURL.py
Log Message:
Fixed bug in context management when uri segments that produce only
side effects (e.g. ++skin++ZopeTop) are used.
Fixed up absolute url bread crumbs to not show side-effect steps in
bread crumbs, while retaining them in the breadcrumb urls.
Refactored side-effect handling slightly (changed context data names)
in absolute url and physical path code.
Added tests for side effect handling for absolute url, physical path,
and namespace handling code.
=== Zope3/lib/python/Zope/App/ZopePublication/TraversalViews/AbsoluteURL.py 1.4 => 1.5 ===
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)
+ name = dict.get('side_effect_name', name)
return "%s/%s" % (getView(container, 'absolute_url', self.request),
name)
@@ -61,8 +61,21 @@
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)
+ # The name is meaningless. There is a side-efect name
+ # that we need to preserve in the urls (only)
+ name = dict.get('side_effect_name', name)
+ base = getView(container, 'absolute_url',
+ self.request).breadcrumbs()
+
+ # replace the last step in base with a step with the same
+ # name ans an augmented url
+ base = base[:-1] + ({
+ 'name': base[-1]['name'],
+ 'url': ("%s/%s" % (base[-1]['url'], name)),
+ }, )
+ return base
base = getView(container, 'absolute_url', self.request).breadcrumbs()
base += ({'name': name, 'url': ("%s/%s" % (base[-1]['url'], name))}, )
@@ -78,7 +91,7 @@
name = dict and dict.get('name') or None
if name:
if name == '.':
- name = dict.get('uri_segment', name)
+ name = dict.get('side_effect_name', name)
container = getWrapperContainer(context)
return "%s/%s" % (getView(container, 'absolute_url', self.request),
name)
@@ -92,15 +105,23 @@
dict = getInnerWrapperData(context)
name = dict and dict.get('name') or None
if name:
+ # The name is meaningless. There is a side-efect name
+ # that we need to preserve in the urls (only)
if name == '.':
- name = dict.get('uri_segment', name)
+ name = dict.get('side_effect_name', name)
container = getWrapperContainer(context)
base = getView(container, 'absolute_url',
self.request).breadcrumbs()
- base += ({'name': name,
- 'url': ("%s/%s" % (base[-1]['url'], name))}, )
+ # replace the last step in base with a step with the same
+ # name ans an augmented url
+ base = base[:-1] + (
+ {'name': base[-1]['name'],
+ 'url': ("%s/%s" % (base[-1]['url'], name))}, )
return base
return ({'name':'', 'url': self.request.getApplicationURL()}, )
+
+
+