[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher - BaseRequest.py:1.1.2.11 Exceptions.py:1.1.2.7

Shane Hathaway shane@digicool.com
Tue, 20 Nov 2001 14:37:04 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Publisher
In directory cvs.zope.org:/tmp/cvs-serv23524/lib/python/Zope/Publisher

Modified Files:
      Tag: Zope-3x-branch
	BaseRequest.py Exceptions.py 
Log Message:
- Stitched together container presentation.

- Changed signature of browser_default and NotFound.


=== Zope3/lib/python/Zope/Publisher/BaseRequest.py 1.1.2.10 => 1.1.2.11 ===
     # It does not include names built from publication.getDefaultTraversal().
     URL = ''
+    effective_url = '' # URL plus the names built from getDefaultTraversal().
     to_traverse = ()   # A sequence containing the names to traverse, reversed.
     steps = ()         # A sequence of names built up during traversal.
     quoted_steps = ()  # Same as steps but quoted.
@@ -106,6 +107,9 @@
         return self.body_instream
     _key_handlers['BODYFILE'] = getBodyFile
 
+    def getEffectiveURL(self):
+        return self.effective_url or self.URL
+
     def get(self, key, default=None):
         """Get a variable value
 
@@ -266,8 +270,12 @@
                     quoted_steps.append(qstep)
                     if not added_default:
                         # Build up the URL to the object, but not
-                        # to the default view.
+                        # to the default traversal.
                         self.URL = '%s/%s' % (self.URL, qstep)
+                    else:
+                        # The effective URL includes the default traversal.
+                        e_url = self.effective_url or self.URL
+                        self.effective_url = '%s/%s' % (e_url, qstep)
                     subobject = publication.traverseName(
                         self, object, entry_name)
                     object = subobject
@@ -279,11 +287,8 @@
                 added_default = 1
                 add_steps = self._request_default
                 if add_steps is None:
-                    r = publication.getDefaultTraversal( self, object)
-                    if type(r) is type( '' ):
-                        add_steps = ( r, )
-                    else:
-                        object, add_steps = r
+                    object, add_steps = publication.getDefaultTraversal(
+                        self, object)
                 if add_steps:
                     to_traverse.extend(add_steps)
 


=== Zope3/lib/python/Zope/Publisher/Exceptions.py 1.1.2.6 => 1.1.2.7 ===
     """
     """
-    def __init__(self, ob, name, url=None):
+    def __init__(self, ob, name, request=None):
         self.ob = ob
         self.name = name
+        if request is not None:
+            url = request.getEffectiveURL()
+        else:
+            url = None
         self.url = url
 
     def getObject(self):