[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/TraversalViews - AbsoluteURL.py:1.6.4.2
Christian Theune
ct@gocept.com
Fri, 22 Nov 2002 18:09:04 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/TraversalViews
In directory cvs.zope.org:/tmp/cvs-serv27965/ZopePublication/TraversalViews
Modified Files:
Tag: ctheune-fix_appcontrol-branch
AbsoluteURL.py
Log Message:
Next attempt
=== Zope3/lib/python/Zope/App/ZopePublication/TraversalViews/AbsoluteURL.py 1.6.4.1 => 1.6.4.2 ===
--- Zope3/lib/python/Zope/App/ZopePublication/TraversalViews/AbsoluteURL.py:1.6.4.1 Fri Nov 22 17:38:17 2002
+++ Zope3/lib/python/Zope/App/ZopePublication/TraversalViews/AbsoluteURL.py Fri Nov 22 18:09:04 2002
@@ -128,16 +128,51 @@
return ({'name':'', 'url': self.request.getApplicationURL()}, )
-class ApplicationControlAbsoluteURL(SiteAbsoluteURL):
+class ApplicationControlAbsoluteURL(BrowserView):
"""Returns the absolute URL for the ApplicationController object.
"""
# XXX This is hardcoded in conjunction to the hardcoded Traversal.
+ name = "++etc++ApplicationController"
def __str__(self):
- return SiteAbsoluteURL.__str__(self) + "++etc++ApplicationController"
+
+ context = self.context
+ dict = getInnerWrapperData(context)
+ name = dict and dict.get('name') or None
+ if name != self.name:
+ if name == '.':
+ name = dict.get('side_effect_name', name)
+ container = getWrapperContainer(context)
+ url = "%s/%s" % (getView(container, 'absolute_url', self.request),
+ name)
+ else:
+ url = self.request.getApplicationURL()
+
+ return url+"++etc++ApplicationController"
+
+ __call__ = __str__
def breadcrumbs(self):
- breadcrumb = SiteAbsoluteURL.breadcrumbs(self)
- return ({'name':'++etc++ApplicationController', 'url':breadcrumb[0]["url"]+"++etc++ApplicationController"})
+ context = self.context
+ dict = getInnerWrapperData(context)
+ name = dict and dict.get('name') or None
+ if name != self.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('side_effect_name', name)
+ container = getWrapperContainer(context)
+ 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))}, )
+ else:
+ base = ({'name':'', 'url': self.request.getApplicationURL()}, )
+
+ return ({'name':'++etc++ApplicationController', 'url':base[0]["url"]+"++etc++ApplicationController"})
+