[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication - PublicationTraverse.py:1.1.2.18.4.2 Traversers.py:1.1.2.18.4.2 ZopePublication.py:1.1.2.39.6.2 zopepublication.zcml:1.1.2.5.4.1

Jim Fulton jim@zope.com
Sun, 2 Jun 2002 10:35:25 -0400


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

Modified Files:
      Tag: Zope3InWonderland-branch
	PublicationTraverse.py Traversers.py ZopePublication.py 
	zopepublication.zcml 
Log Message:
- Added template attribute to allow views to be created from a
  template source file.

- Added beginnings of a Zope debugger. This required seperating site
  and server configuration.

- Added the ability to specify a config file package in the
  zopeConfigure directive. Made "config.zcml" a default for the file
  attribute in the include directive.

- Fixed mapply to unwrap proxied objects. This was necessary once
  views became wrapped in proxies. We need to investigate why they
  weren't being wrapped before. 

- I updated enough system page templates and zcml directives so that:

  - Zope now starts. :)

  - The root folder contents listing can be viewed.

  Many more templates and zcml files need to be updated to reflect the
  way views are now handled.



=== Zope3/lib/python/Zope/App/ZopePublication/PublicationTraverse.py 1.1.2.18.4.1 => 1.1.2.18.4.2 ===
 """
 
-from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
 from Zope.ComponentArchitecture import queryView, getService
 from Zope.Publisher.Exceptions import NotFound
 from types import StringTypes
@@ -28,6 +27,7 @@
 from Zope.Proxy.ProxyIntrospection import removeAllProxies
 from Zope.App.Traversing.Namespaces import namespaceLookup
 from Zope.App.Traversing.ParameterParsing import parameterizedNameParse
+from Zope.Publisher.IPublishTraverse import IPublishTraverse
 
 class DuplicateNamespaces(Exception):
     """More than one namespace was specified in a request"""
@@ -41,7 +41,7 @@
 
         nm = name # the name to look up the object with
 
-        if name.find(';') >= 0:
+        if ':' in name or ';' in name:
             # Process URI segment parameters. 
             ns, nm, parms = parameterizedNameParse(name)
 
@@ -74,7 +74,7 @@
         if nm == '.':
             return ob
                 
-        if request.getPresentationType().isImplementedBy(removeAllProxies(ob)):
+        if IPublishTraverse.isImplementedBy(removeAllProxies(ob)):
             ob2 = ob.publishTraverse(request, nm)
         else:
             adapter = queryView(ob, '_traverse', request, self # marker


=== Zope3/lib/python/Zope/App/ZopePublication/Traversers.py 1.1.2.18.4.1 => 1.1.2.18.4.2 ===
 
 
-class HTMLContentTraverser(SimpleComponentTraverser):
-    """Browser traverser for HTML content.
+class FileContentTraverser(SimpleComponentTraverser):
+    """Browser traverser for file content.
+
+    The default view for file content has effective URLs that don't end in
+    /.  In particular, if the content inclused HTML, relative links in
+    the HTML are relative to the container the content is in.
 
-    HTML content is content that authors expect to be used like simple
-    HTML pages. In particular, for the default view, URLs should be
-    relative to the container containing the content. 
     """
 
     def browserDefault(self, request):
@@ -79,14 +80,14 @@
         
             view_name = getDefaultViewName(ob, request)
 
-            return ob, (("%s;view" % view_name),)
+            return ob, (("view::%s" % view_name),)
         
         return ob, ()
 
     def publishTraverse(self, request, name):
         ob = self.target
-        if name.endswith(';view'):
-            return getView( ob, name[:-5], request)
+        if name.startswith('view::'):
+            return getView(ob, name[6:], request)
             
         if name.startswith('_'):
             raise Unauthorized("Name %s begins with an underscore" % `name`)


=== Zope3/lib/python/Zope/App/ZopePublication/ZopePublication.py 1.1.2.39.6.1 => 1.1.2.39.6.2 ===
     def getApplication(self, request):
 
-        # If the first name is 'ApplicationControl;etc', then we should
+        # If the first name is 'etc::ApplicationControl', then we should
         # get it rather than look in the database!
         stack = request.getTraversalStack()
         if stack:
             name = stack[-1]
-            if name.startswith('ApplicationController;'):
-                parms = name.split(';')
-                if 'etc' in parms or 'ns=etc' in parms:
-                    stack.pop() # consume the name
-                    request.setTraversalStack(stack) # Reset the stack
-                    return self.traverseName(request, None, name)
+            if (name.startswith('etc::ApplicationController') and
+                (name == 'etc::ApplicationController' or
+                 name.startswith('etc::ApplicationController;'))):
+                stack.pop() # consume the name
+                request.setTraversalStack(stack) # Reset the stack
+                return self.traverseName(request, None, name)
         
         # Open the database.
         version = request.get(self.version_cookie, '')


=== Zope3/lib/python/Zope/App/ZopePublication/zopepublication.zcml 1.1.2.5 => 1.1.2.5.4.1 ===
 
 <browser:view name="_traverse" 
- for="Zope.App.OFS.Content.IHTMLContent."
- factory="Zope.App.ZopePublication.Traversers.HTMLContentTraverser" />
+ for="Zope.App.OFS.Content.IFileContent."
+ factory="Zope.App.ZopePublication.Traversers.FileContentTraverser" />
 
   <xmlrpc:view name="_traverse" 
    for="Interface.Interface"