[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/HTTP - HTTPPublicationTraverse.py:1.1.4.5

Jim Fulton jim@zope.com
Thu, 23 May 2002 14:01:50 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/HTTP
In directory cvs.zope.org:/tmp/cvs-serv26429/lib/python/Zope/App/ZopePublication/HTTP

Modified Files:
      Tag: Zope-3x-branch
	HTTPPublicationTraverse.py 
Log Message:
This all started with wanting to be able to use url;view in a ZPT path. :)

That lead me to:

- Massive traversal refactoring.

  Namespace handling is now centralized in Zope.App.Traversing. 

- ZPT refactoring, including some renaming that touches pretty much everything. :)

  - The application specific ZPT support was moved into
    Zope.App.PageTemplate. 

  - To get page template files (for use in views):

    from Zope.App.PageTemplate import ViewPageTemplateFile

  - Fixed up security so that ZPT expressions only have access to 
    safe builtins and so that modules namespace does imports safely.

  - Got ZPTPage working!

- renaming url to absolute_url and got absolute_url to work in paths.

- Cleaned up the (as yet unused) RestrictedInterpreter module in
  Zope.Security. In particular, changed to use a separate
  RestrictedBuiltins module.



=== Zope3/lib/python/Zope/App/ZopePublication/HTTP/HTTPPublicationTraverse.py 1.1.4.4 => 1.1.4.5 ===
 
 class DuplicateNamespaces(Exception):
-    """More than one namespave was specified in a request"""
+    """More than one namespace was specified in a request"""
 
     
 class UnknownNamespace(Exception):
@@ -91,7 +91,7 @@
                     raise UnknownNamespace(ns, name)
 
                 ob2 = traverse(request, ob, nm)
-                return self._wrap(ob2, ob, name, nm)
+                return ContextWrapper(ob2, ob, name=name)
             elif not nm:
                 # Just set params, so skip
                 return ob
@@ -101,22 +101,9 @@
                 
         ob2 = self.getViewFromObject(ob, name, request)
 
-        return self._wrap(ob2, ob, name, nm)
-
-
-    def _wrap(self, ob, parent, name, nm):
-        wrapped = ContextWrapper(ob, parent, name=name)
-        return wrapped
-
+        return ContextWrapper(ob2, ob, name=name)
 
     def _traverseview(self, request, ob, name):
-        # use self as marker
-        #import traceback
-        #traceback.print_stack()
-        #print ob
-        #print name
-        #print request.getViewType()
-        #print 
         r = getRequestView(ob, name, request, self)
         if r is self: 
             raise NotFound(ob, name, request)
@@ -145,7 +132,7 @@
         if method is self: 
             raise NotFound(ob, name, request)
         # Check access
-        self._wrap(method, ob, name, name)
+        ContextWrapper(method, ob, name=name)
 
         return method()