Log message for revision 67645:
  DefaultVieable now makes index.html the default, and therefore retains 
exactly the 
  same behaviour as before.
  
  

Changed:
  U   Products.Five/branches/regebro-traversal_refactor/browser/configure.zcml
  U   
Products.Five/branches/regebro-traversal_refactor/browser/tests/defaultview.zcml
  U   
Products.Five/branches/regebro-traversal_refactor/browser/tests/test_defaultview.py
  U   Products.Five/branches/regebro-traversal_refactor/fiveconfigure.py

-=-
Modified: 
Products.Five/branches/regebro-traversal_refactor/browser/configure.zcml
===================================================================
--- Products.Five/branches/regebro-traversal_refactor/browser/configure.zcml    
2006-04-27 13:45:51 UTC (rev 67644)
+++ Products.Five/branches/regebro-traversal_refactor/browser/configure.zcml    
2006-04-27 13:49:19 UTC (rev 67645)
@@ -1,7 +1,8 @@
 <configure xmlns="http://namespaces.zope.org/zope";
            xmlns:browser="http://namespaces.zope.org/browser";>
 
-  <!--browser:defaultView name="index.html" /-->
+  <browser:defaultView for="Products.Five.interfaces.IBrowserDefault" 
+                       name="index.html" />
 
   <interface
       interface="zope.publisher.interfaces.browser.ILayer"

Modified: 
Products.Five/branches/regebro-traversal_refactor/browser/tests/defaultview.zcml
===================================================================
--- 
Products.Five/branches/regebro-traversal_refactor/browser/tests/defaultview.zcml
    2006-04-27 13:45:51 UTC (rev 67644)
+++ 
Products.Five/branches/regebro-traversal_refactor/browser/tests/defaultview.zcml
    2006-04-27 13:49:19 UTC (rev 67645)
@@ -2,17 +2,20 @@
            xmlns:browser="http://namespaces.zope.org/browser";
            xmlns:five="http://namespaces.zope.org/five";>
 
-  <!--five:defaultViewable
-      class="Products.Five.tests.testing.simplecontent.SimpleContent" /-->
+  <five:defaultViewable
+      class="Products.Five.tests.testing.simplecontent.SimpleContent" />
 
-  <browser:defaultView
+  <browser:page
       for="Products.Five.tests.testing.simplecontent.ISimpleContent"
       name="eagledefaultview.txt"
+      class=".pages.SimpleView"
+      attribute="mouse"
+      permission="zope2.Public"
       />
 
   <browser:page
       for="Products.Five.tests.testing.simplecontent.ISimpleContent"
-      name="eagledefaultview.txt"
+      name="index.html"
       class=".pages.SimpleView"
       attribute="eagle"
       permission="zope2.Public"

Modified: 
Products.Five/branches/regebro-traversal_refactor/browser/tests/test_defaultview.py
===================================================================
--- 
Products.Five/branches/regebro-traversal_refactor/browser/tests/test_defaultview.py
 2006-04-27 13:45:51 UTC (rev 67644)
+++ 
Products.Five/branches/regebro-traversal_refactor/browser/tests/test_defaultview.py
 2006-04-27 13:49:19 UTC (rev 67645)
@@ -46,8 +46,7 @@
       >>> uf = self.folder.acl_users
       >>> uf._doAddUser('manager', 'r00t', ['Manager'], [])
 
-    Test a simple default view:
-
+    Test that index.html is still the default view:
       >>> print http(r'''
       ... GET /test_folder_1_/testoid HTTP/1.1
       ... Authorization: Basic manager:r00t
@@ -56,6 +55,23 @@
       ...
       The eagle has landed
 
+
+    But if we want to, we can specify another default view with 
+    browser:defaultView:
+      >>> zcml.load_string('''
+      ... <configure xmlns:browser="http://namespaces.zope.org/browser";>
+      ...   <browser:defaultView
+      ...     for="Products.Five.tests.testing.simplecontent.ISimpleContent"
+      ...     name="eagledefaultview.txt" />
+      ... </configure>''')
+      >>> print http(r'''
+      ... GET /test_folder_1_/testoid HTTP/1.1
+      ... Authorization: Basic manager:r00t
+      ... ''')
+      HTTP/1.1 200 OK
+      ...
+      The mouse has been eaten by the eagle
+
     This tests whether an existing ``index_html`` method is still
     supported and called:
 

Modified: Products.Five/branches/regebro-traversal_refactor/fiveconfigure.py
===================================================================
--- Products.Five/branches/regebro-traversal_refactor/fiveconfigure.py  
2006-04-27 13:45:51 UTC (rev 67644)
+++ Products.Five/branches/regebro-traversal_refactor/fiveconfigure.py  
2006-04-27 13:49:19 UTC (rev 67645)
@@ -149,6 +149,7 @@
 
 _defaultviewable_monkies = []
 def classDefaultViewable(class_):    
+    # XXX deprecated, can be removed
     # If a class already has this attribute, it means it is either a
     # subclass of DefaultViewable or was already processed with this
     # directive; in either case, do nothing... except in the case were
@@ -175,16 +176,26 @@
     # remember class for clean up
     _defaultviewable_monkies.append(class_)
 
+from zope.component import getSiteManager, provideAdapter
+from zope.interface import providedBy
+from zope.publisher.interfaces.browser import IBrowserRequest
+from zope.component.interfaces import IDefaultViewName
+from interfaces import IBrowserDefault
+
 def defaultViewable(_context, class_):
     warnings.warn("The five:defaultViewable statement is no longer needed " \
-                  "and will be removed in Zope 2.12",
+                  "and will be removed in Zope 2.12. \n If you rely on it " \
+                  "to make 'index.html' the default view, replace it with " \
+                  "<browser:defaultView name='index.html' />",
                   DeprecationWarning, 2)
+    implements(_context, class_, (IBrowserDefault,))
     return
-    _context.action(
-        discriminator = None,
-        callable = classDefaultViewable,
-        args = (class_,)
-        )
+    # XXX old code
+    #_context.action(
+        #discriminator = None,
+        #callable = classDefaultViewable,
+        #args = (class_,)
+        #)
 
 def createZope2Bridge(zope2, package, name):
     # Map a Zope 2 interface into a Zope3 interface, seated within 'package'

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to